]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-09/progress_box.py
fix building/running of tex2rtf
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-09 / progress_box.py
1 import wx
2
3 class Frame(wx.Frame):
4 def __init__(self, parent):
5 wx.Frame.__init__(self, parent, title="ProgressDialog sample")
6 self.progressMax = 100
7 self.count = 0
8 self.dialog = None
9 self.timer = wx.Timer(self)
10 self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
11 self.timer.Start(1000)
12
13 def OnTimer(self, evt):
14 if not self.dialog:
15 self.dialog = wx.ProgressDialog("A progress box", "Time remaining",
16 self.progressMax,
17 style=wx.PD_CAN_ABORT
18 | wx.PD_ELAPSED_TIME
19 | wx.PD_REMAINING_TIME)
20
21 self.count += 1
22 keepGoing = self.dialog.Update(self.count)
23 if not keepGoing or self.count == self.progressMax:
24 self.dialog.Destroy()
25 self.timer.Stop()
26
27
28 if __name__ == "__main__":
29 app = wx.PySimpleApp()
30 frame = Frame(None)
31 frame.Show()
32 app.MainLoop()
33