The following defines the creation of a WinForms.Timer
import CLR
import CLR.System.Windows.Forms as WinForms
self.timer = WinForms.Timer()
self.timer.Tick += self.TimerTickHandler
self.timer.Interval = 1000
self.timer.Enabled = 1
def TimerTickHandler(self, sender, args):
# Handles timer tick
if self.stopWatch.Running:
self.textBox.Text = str(int(self.stopWatch.ElapsedSeconds))
|