[wxpython-users] Re: Does wxUpdateUIEvent.SetUpdateInterval() work?

Gre7g Luterman gre7g.luterman at gmail.com
Fri May 2 09:33:50 PDT 2008


On 5/1/08, Robin Dunn <robin at alldunn.com> wrote:
>
> I don't remember it not working in 2..4.0, but it is working for me in my
> quickie test with 2.8.7.1.  Please either try 2.8.7.1 or send a small
> runnable sample that demonstrates the problem for you and then somebody h=
ere
> can try it with the current version.  That way we can be sure we are
> checking the same thing.


Yay! I solved the problem. It wasn't actually a problem with the event
handler, wxPython version, SetUpdateInterval() call, or compiler flags. Even
though you may not be interested, I'll post the answer here so that if
anyone comes across this when searching the archives, they'll know:

The problem is that I was binding the wx.EVT_UPDATE_UI event to the frame
and not specifying the frame's ID in the bind statement. i.e. I was doing
something like:

self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI)

instead of:

self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI, id=3Dself.GetId())

 So, when it came time to update the user interface, wx was posting an event
for *EVERY GUI ITEM IN EVERY PANEL*. Since these items don't have
wx.EVT_UPDATE_UI handlers, those events floated up until they hit the
handler for the frame itself. It turns out that I wasn't actually getting a
steady stream of events, but that I was getting HUNDREDS every time the
handler should fire instead of just one.

Many thanks for your patience!
Gre7g
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200805=
02/00b5981f/attachment.htm


More information about the wxpython-users mailing list