[wxPython-users] slider.SetValue(x) doesnt send a slider event

Robin Dunn robin at alldunn.com
Fri Sep 29 11:16:47 PDT 2006


Jim Carroll wrote:
> Hi,
> 
> I want a slider (wx.Slider) to generate an event when I do SetValue.  At the
> moment, it generates events if its interacting with the user, but when I set it
> programmatically, I can see it move, but the code that needs the value and
> listens for events is not getting the event.
> 
> How can I have my slider generate an EVT_SLIDER when I set its value?

The general rule in wxWidgets is that events are not sent when values 
are changed programatically.  (There are exceptions to this, mainly 
those that were already sending an event before the rule was made.)  So 
your options are to either send the event yourself, or refactor your 
event handler so it calls another method to do its work that you can 
also call yourself after doing the SetValue.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list