]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/ProgressDialog.py
wxUSE_STL/wxArrayString fixes.
[wxWidgets.git] / wxPython / demo / ProgressDialog.py
... / ...
CommitLineData
1# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2#
3# o Updated for wx namespace
4#
5# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
6#
7# o wx.ProgressDialog appears to be broken. No abort button
8# and it's not possible to dismiss it otherwise.
9#
10
11import wx
12
13#---------------------------------------------------------------------------
14
15def runTest(frame, nb, log):
16 max = 20
17
18 dlg = wx.ProgressDialog("Progress dialog example",
19 "An informative message",
20 maximum = max,
21 parent=frame,
22 style = wx.PD_CAN_ABORT | wx.PD_APP_MODAL)
23
24 keepGoing = True
25 count = 0
26
27 while keepGoing and count < max:
28 count = count + 1
29 #print count
30 wx.Sleep(1)
31
32 if count == max / 2:
33 keepGoing = dlg.Update(count, "Half-time!")
34 else:
35 keepGoing = dlg.Update(count)
36
37 dlg.Destroy()
38
39
40#---------------------------------------------------------------------------
41
42
43overview = """\
44<html><body>
45This class represents a dialog that shows a short message and a progress bar.
46Optionally, it can display an ABORT button
47<p>
48This dialog indicates the progress of some event that takes a while to accomplish,
49usually, such as file copy progress, download progress, and so on. The display
50is <b>completely</b> under control of the program; you must update the dialog from
51within the program creating it.
52<p>
53When the dialog closes, you must check to see if the user aborted the process or
54not, and act accordingly -- that is, if the PD_CAN_ABORT style flag is set.
55If not then you may progress blissfully onward.
56</body></html>
57"""
58
59if __name__ == '__main__':
60 import sys,os
61 import run
62 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])