I'm trying to use wx.ProgressBar, and the cancel button is not responding. Here is a simple program that exhibits the problem:
######################################################### import wx import time max = 10 app = wx.PySimpleApp() dlg = wx.ProgressDialog("Progress dialog example", "variables to be shown here", maximum = max, style = wx.PD_CAN_ABORT | wx.PD_CAN_SKIP #| wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME | wx.PD_ESTIMATED_TIME | wx.PD_REMAINING_TIME ) keepGoing = True skip = False count = 0 while keepGoing and count < max: count += 1 wx.MilliSleep(1000) #time.sleep(1) newtext = "(before) count: %s, keepGoing: %s, skip: %s " % \ (count, keepGoing, skip) print newtext (keepGoing, skip) = dlg.Update(count, newtext) newtext = "(after) count: %s, keepGoing: %s, skip: %s " % \ (count, keepGoing, skip) print newtext dlg.Destroy() ######################################################### The dialog looks right when this runs, but.... What's right: I get a progress bar; it includes "Skip" and "Cancel" buttons; it shows 10 seconds of progress, and updates once per second with the variables' values on each iteration. What's wrong is that I can't get clicking on the "Skip" or "Cancel" buttons to have any effect. Instead, as soon as the dialog displays, I get an hourglass, and it doesn't matter what I click on. Here's what the print statements display, consistently, regardless of what I try to click or whether I click nothing at all: I:\python>test1.py (before) count: 1, keepGoing: True, skip: False (after) count: 1, keepGoing: True, skip: False (before) count: 2, keepGoing: True, skip: False (after) count: 2, keepGoing: True, skip: True (before) count: 3, keepGoing: True, skip: True (after) count: 3, keepGoing: True, skip: True (before) count: 4, keepGoing: True, skip: True (after) count: 4, keepGoing: True, skip: True (before) count: 5, keepGoing: True, skip: True (after) count: 5, keepGoing: True, skip: True (before) count: 6, keepGoing: True, skip: True (after) count: 6, keepGoing: True, skip: True (before) count: 7, keepGoing: True, skip: True (after) count: 7, keepGoing: True, skip: True (before) count: 8, keepGoing: True, skip: True (after) count: 8, keepGoing: True, skip: True (before) count: 9, keepGoing: True, skip: True (after) count: 9, keepGoing: True, skip: True (before) count: 10, keepGoing: True, skip: True (after) count: 10, keepGoing: True, skip: True Two oddities here: 1) As I read the docs, the keepGoing variable should be set to True, unless I click on "Cancel," in which case it should be set to False (which would end the loop). That doesn't happen. This is really what I'm most concerned here with. 2) The variable "skip: set to False on the first iteration, and then set to True on subsequent iterations? Note that this happens even if no buttons are selected. This is just a weirdness to me, and not my main concern, but I thought I'd mention it in case it's relevant. You can see some variations in the commented-out code that I tried; they did not help. Relevant software and releases: OS: Windows XP Home Edition, Version 2002, SP2 Python: ActivePython 2.5.0.0 wxPython: 2.8.1.1 (msw-unicode) Any help appreciated. -- http://mail.python.org/mailman/listinfo/python-list