Momentary button

26 views
Skip to first unread message

Greg - ZL3IX

unread,
May 24, 2012, 5:11:56 AM5/24/12
to wxpytho...@googlegroups.com
Am I right in thinking that wxButton cannot bind in a momentary fashion,
ie trigger an event when the mouse button is pressed (on the button),
and another when it is released? I have tried to bind it using
wx.EVT_LEFT_DOWN, but the event is not triggered. I get the feeling
that the only event that can be detected is that the mouse button has
been clicked and released. Is that correct?

If that is so (surprising) I guess I have to detect mouse hover over the
button AND left button down. Seems a little clumsy maybe?

Greg

Chris Barker

unread,
May 24, 2012, 1:20:43 PM5/24/12
to wxpytho...@googlegroups.com
On Thu, May 24, 2012 at 2:11 AM, Greg - ZL3IX <zl...@inet.net.nz> wrote:
> Am I right in thinking that wxButton cannot bind in a momentary fashion,
> ie trigger an event when the mouse button is pressed (on the button),
> and another when it is released?  I have tried to bind it using
> wx.EVT_LEFT_DOWN, but the event is not triggered.  I get the feeling
> that the only event that can be detected is that the mouse button has
> been clicked and released.  Is that correct?

THis may well be platfrom-dependent behaviour. As wx uses the platfrom
native widgets, it's really only reliable to use a button like a
button is usually used.

I"d take a look at wx.lib.button.GenButton (and others in
wx.lib.buttons) -- that should be easier to customize.

-Chris

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris....@noaa.gov

Greg - ZL3IX

unread,
May 25, 2012, 12:16:43 AM5/25/12
to wxpytho...@googlegroups.com
Many thanks for the tip, Chris.

That worked a treat!

Greg
Reply all
Reply to author
Forward
0 new messages