任何人都可以告诉我如何在wxPython中实现字幕样式的进度条?作为MSDN说:wxPython中的字幕样式进度条
您可以在显示 活动,但并不表示什么任务 比例是完整的方式制作动画。
谢谢。
alt text http://i.msdn.microsoft.com/dynimg/IC100842.png
我试过,但它似乎并没有工作。计时器会打勾,但量表不会滚动。任何帮助?
import wx
import time
class MyForm(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, "Timer Tutorial 1",
size=(500,500))
# Add a panel so it looks the correct on all platforms
panel = wx.Panel(self, wx.ID_ANY)
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.update, self.timer)
self.gauProgress = wx.Gauge(panel, range=1000, pos=(30, 50), size=(440, 20))
self.toggleBtn = wx.Button(panel, wx.ID_ANY, "Start")
self.toggleBtn.Bind(wx.EVT_BUTTON, self.onToggle)
def onToggle(self, event):
btnLabel = self.toggleBtn.GetLabel()
if btnLabel == "Start":
print "starting timer..."
self.timer.Start(1000)
self.toggleBtn.SetLabel("Stop")
else:
print "timer stopped!"
self.timer.Stop()
self.toggleBtn.SetLabel("Start")
def update(self, event):
print "\nupdated: ",
print time.ctime()
self.gauProgress.Pulse()
# Run the program
if __name__ == "__main__":
app = wx.PySimpleApp()
frame = MyForm().Show()
app.MainLoop()
这是Vista还是XP与Vista布局?我知道XP的一个布局引擎,其中wxGauge的脉冲显示不起作用。您发布的代码适用于vista。 – Rudi 2010-05-19 05:30:30
这在XP上使用了常规布局,但不适用于Windows 7.我猜想它也不适用于Windows Vista。有任何解决这个问题的方法吗? – 2010-05-19 06:58:23
似乎这已经被报告为wxPython问题跟踪系统上的一个错误。 http://trac.wxwidgets.org/ticket/11357 – 2010-05-21 07:45:22