wxpython: how does EVT_IDLE work?

John Salerno johnjsal at NOSPAMgmail.com
Mon Jul 10 15:58:46 EDT 2006


Quick question about the code below: I understand why the progress bar 
fills up at a steady pace when the mouse is idle over the frame; but 
why, when you move the mouse, does the progress bar speed up? Shouldn't 
it stop completely until the mouse is idle again?

Also, on a side note, I'm confused by the use of the word "bevel" and 
"bezel". The methods seem to use "bezel", but according to wxPython in 
Action, it's referring to the bevel of the border of the widget. Also, 
the book refers to a method called SetBevelWidth(), but the code shows 
it as SetBezelWidth() -- and only the latter works -- so what's the deal 
with these words?

Thanks!

--------------------------------------

import wx

class GaugeFrame(wx.Frame):

     def __init__(self):
         wx.Frame.__init__(self, None, -1, 'Gauge Example')
         panel = wx.Panel(self)
         self.count = 0
         self.gauge = wx.Gauge(panel, -1, 50, (20, 50), (250, 25))
         self.gauge.SetBevelFace(3)
         self.gauge.SetShadowWidth(3)
         self.Bind(wx.EVT_IDLE, self.OnIdle)

     def OnIdle(self, event):
         self.count += 1
         if self.count >= 50:
             self.count = 0
         self.gauge.SetValue(self.count)

if __name__ == '__main__':
     app = wx.App(redirect=False)
     GaugeFrame().Show()
     app.MainLoop()



More information about the Python-list mailing list