September 5th, 2005, 11:56 AM
-
key combination as key event in wxpython
I have some question about handling key events in wxPython
I want to be able to handle key event caused by custom key combinations, for instance 'INS + right arrow'
So far all I can find in the documentation is that I can check whether a special key is curently being pressed during a WXK_KEY_UP event handler, as shown the the following example
Code:
def onKeyUp(event):
if event.KeyCode() == wx.WXK_RIGHT:
if event.AltDown():
print "ALT - right arrow combination detected!"
But such event.XXXDown() functions are only available for the ALT, CTRL and SHIFT key.
How do I check whether a different key is currently being pressed?
And another thing: is it possible if a certain key is "double pressed"? For instance to detect if the right arrow button was released twice quickly?
September 5th, 2005, 01:23 PM
-
Can't you use the and keyword? If thiskeyisdown and thiskeyisdown then do something.
September 5th, 2005, 02:47 PM
-
That would be a solution, however so far I haven't found such a 'thiskeyisdown' kind of method that I can use, apart from AltDown, ShiftDown, CmdDown, MetaDown and ControlDown. What I'm looking for is a way to check if any other key besides those is currently down.
September 5th, 2005, 03:36 PM
-
I'm too busy at the moment to go and check. But isn't there a function that returns a boolean (true/false) value of whether a key is pressed down or not? Did you try checking the wxPython samples for such an example? I'm pretty sure I remember seeing this there.