]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-07/gauge.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-07 / gauge.py
1 import wx
2
3 class GaugeFrame(wx.Frame):
4 def __init__(self):
5 wx.Frame.__init__(self, None, -1, 'Gauge Example',
6 size=(350, 150))
7 panel = wx.Panel(self, -1)
8 self.count = 0
9 self.gauge = wx.Gauge(panel, -1, 50, (20, 50), (250, 25))
10 self.gauge.SetBezelFace(3)
11 self.gauge.SetShadowWidth(3)
12 self.Bind(wx.EVT_IDLE, self.OnIdle)
13
14 def OnIdle(self, event):
15 self.count = self.count + 1
16 if self.count >= 50:
17 self.count = 0
18 self.gauge.SetValue(self.count)
19
20 if __name__ == '__main__':
21 app = wx.PySimpleApp()
22 GaugeFrame().Show()
23 app.MainLoop()