473,396 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

wxpython: how does EVT_IDLE work?

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()
Jul 10 '06 #1
3 6864
John Salerno wrote:
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?
Ok, now I'm really confused. I just ran the code again and this time it
*doesn't* increase the progress bar when the mouse is idle, and it only
increases when I move it. This wasn't the behavior just a few minutes
ago, and I didn't change anything! What's going on?
self.gauge.SetBevelFace(3)
Should be 'Bezel'.
Jul 10 '06 #2
John Salerno wrote:
Ok, now I'm really confused. I just ran the code again and this time it
*doesn't* increase the progress bar when the mouse is idle, and it only
increases when I move it. This wasn't the behavior just a few minutes
ago, and I didn't change anything! What's going on?
Ok, this helps explain why moving the mouse causes the idle event:

"Note that, unless you do something specifically, the idle events are
not sent if the system remains idle once it has become it, e.g. only a
single idle event will be generated until something else resulting in
more normal events happens and only then is the next idle event sent again."

But I'm still confused about why *not* moving the mouse still allowed
the progress bar to increase (although that behavior has stopped now for
some reason).
Jul 10 '06 #3
John Salerno wrote in news:Wj******************@news.tufts.edu in
comp.lang.python:
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?
wxWidgets is sending the idle event after it has processed all
other events, but it just sends it once not in a loop.

see the documentation (help) for wxIdleEvent::RequestMore.

>
def OnIdle(self, event):
event.RequestMore(True)
self.count += 1
if self.count >= 50:
self.count = 0
Rob.
--
http://www.victim-prime.dsl.pipex.com/
Jul 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jive Dadson | last post by:
I'm trying (without conspicuous success) to start learning wxPython. Sooo... I opened the doc page wxPythonManual.html#wxpython-overview. The very first example does not work. Try it. I find...
15
by: Grant Edwards | last post by:
Can anybody recommend a good book on wxPython? Are there any books on wxPython? I've been trying to learn wxPython and/or wax for a few weeks, and I'm just not getting it. wxWindows seems...
2
by: Taki Jeden | last post by:
Hi Anybody used wxPython with twisted? I started putting together a Twisted-based app with wx GUI, and the widgets just don't work - some controls do not show up etc. - at least on my system....
25
by: TPJ | last post by:
GUI's etc: PyGtk on Windows "(...) So if someone develops mainly for X and just wants to make sure that it is not impossible to run on Windows, you can use PyGTK. (...)", July 2nd, 1999 pyGTK...
2
by: F. GEIGER | last post by:
I've def'ed a handler for EVT_IDLE in the app's main frame. There I'd like to call the nanothreads' __iter__ method, somehow. When I copy the __iter__ method into a, say, runOnce() method and...
0
by: Soren | last post by:
Hi, I'm trying to create a small GUI program where I can do plots using Matplotlib. I've been trying to borrow code from the examples at the matplotlib website, but I can't get it to work. I...
0
by: Soren | last post by:
Hi, I've been trying to embed matplotlib in wxpython. I want to be able to put a figure (axes) in a wx.Panel and place it somewhere in my GUI. The GUI should have other panels with buttons etc....
8
by: Sean DiZazzo | last post by:
Is there something special you have to do to get a wxPython app to run remotely under xwindows? My Tkinter apps always automatically work that way, so I was surprised to even be confronted with...
16
by: Andrea Gavana | last post by:
Hi Diez & All, Do you mind explaining "why" you find it *buttugly*? I am asking just out of curiosity, obviously. I am so biased towards wxPython that I won't make any comment on this thread...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.