]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/ProgressDialog.py
   1 # 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net) 
   3 # o Updated for wx namespace 
   5 # 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net) 
   7 # o wx.ProgressDialog appears to be broken. No abort button 
   8 #   and it's not possible to dismiss it otherwise. 
  13 #--------------------------------------------------------------------------- 
  15 class TestPanel(wx
.Panel
): 
  16     def __init__(self
, parent
, log
): 
  18         wx
.Panel
.__init
__(self
, parent
, -1) 
  20         b 
= wx
.Button(self
, -1, "Create and Show a ProgressDialog", (50,50)) 
  21         self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
) 
  24     def OnButton(self
, evt
): 
  27         dlg 
= wx
.ProgressDialog("Progress dialog example", 
  28                                "An informative message", 
  31                                style 
= wx
.PD_CAN_ABORT
 
  34                                 #| wx.PD_ESTIMATED_TIME 
  35                                 | wx
.PD_REMAINING_TIME
 
  41         while keepGoing 
and count 
< max: 
  46                 (keepGoing
, skip
) = dlg
.Update(count
, "Half-time!") 
  48                 (keepGoing
, skip
) = dlg
.Update(count
) 
  53 #--------------------------------------------------------------------------- 
  56 def runTest(frame
, nb
, log
): 
  57     win 
= TestPanel(nb
, log
) 
  60 #--------------------------------------------------------------------------- 
  65 This class represents a dialog that shows a short message and a progress bar.  
  66 Optionally, it can display an ABORT button 
  68 This dialog indicates the progress of some event that takes a while to accomplish,  
  69 usually, such as file copy progress, download progress, and so on. The display 
  70 is <b>completely</b> under control of the program; you must update the dialog from 
  71 within the program creating it.  
  73 When the dialog closes, you must check to see if the user aborted the process or 
  74 not, and act accordingly -- that is, if the PD_CAN_ABORT style flag is set.  
  75 If not then you may progress blissfully onward. 
  79 if __name__ 
== '__main__': 
  82     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])