Re: Button and Key Event

2006-03-16 Thread lux
Thanks,
I think that the solution for my problem is only to use an
AcceleratorTable.
In this way I can capture the key pressed event
without the button problem

Luca

-- 
http://mail.python.org/mailman/listinfo/python-list


Button and Key Event

2006-03-15 Thread lux
Hi,
how to enable EVT_CHAR or EVT_KEY_DOWN in a wxButton?

Thank's, Luca

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Button and Key Event

2006-03-15 Thread [EMAIL PROTECTED]
assuming you have a button instantiated and named myButton

in 2.6 (namespace is relevant I think prior to 2.4 you had a diff
namespace for wx)  for this example  i am guessing you are creating the
button as part of a panel or some other object you are extending (ie
self)



self.myButton.Bind(wx.EVT_KEY_DOWN, self.OnLeftDownHandler )





Make sure you define a method OnLeftDownHandler on the parent object.

As a further thought is this really what you are trying to do?
Or do you want to know if a key is pressed when someone clicks on the
button?  Check the mouse events, I know you can check if control or
shift was pressed during a mouse click, not sure if you can do any
arbitrary key.  Binding the key event will not accomplish that if that
is what you want to know, well you might be able to torture around to
it if that's what you want.  The other problem is the key event should
only register if the button has keyboard focus - kind of an odd
situation.  So you may want to place the key listener on the parent
object.


Or you may want to look into creating a custom event.  Hope this helps.
Also be warry of behavior of evt_char in windows.  Can't remember what,
but there is something funky there - I'm sure that was helpful ;)

-- 
http://mail.python.org/mailman/listinfo/python-list