A few things.
- I can't reproduce this on my iMac, it goes all the way to full. Python 2.5.4, wxPython 2.8.9.2
- Idle events can come at strange times. Try adding
print event to your idle handler to see exactly when those events are coming. A timer would be best. Is the gauge moving really fast or flickering?
- You can try calling gauge.Update() to force a complete redraw too.
- I always just use 100 as my gauge limit, maybe just try that.
An easier way than a timer could be:
import wx
class GaugeFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "Gauge example",
size=(350, 150))
panel = wx.Panel(self, -1)
self.count = 0
self.gauge = wx.Gauge(panel, -1, 50, (20, 50), (250, 25))
self.update_gauge()
def update_gauge(self):
self.count = self.count + 1
if self.count >= 50:
self.count = 0
self.gauge.SetValue(self.count)
wx.CallLater(100, self.update_gauge)
app = wx.PySimpleApp()
GaugeFrame().Show()
app.MainLoop()