wx.ProgressDialog未返回元组
大家好,
我在试着拿到
(继续,跳过)=wx.ProgressDialog(...)
但我一直收到一个错误
我从另一篇关于wx.ProgressDialog的帖子中窃取了下面的代码,它被报告为在那里工作,但它给出了相同的错误。
选择 | 换行 | 行号
- (before) count: 1, keepGoing: True, skip: False
- Traceback (most recent call last):
- File "progdial.py", line 28, in <module>
- (keepGoing, skip) = dlg.Update(count, newtext)
- TypeError: 'bool' object is not iterable
选择 | 换行 | 行号
- 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()
我在Ubuntu 9.04上使用的是Python2.6.2和python-wxgtk2.8
任何建议都是非常有用的,我还没能在谷歌上搜索到任何有同样问题的人。
EJ