|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
wxPython + Keyboard Shortcut
Is it possible to make a Function to be triggered by keyboard shortcut without associating it with menu in wxPython? For eg. I want the program to do something when the user press Alt+K but doesn't have the menu for it.
|
|
#2
|
||||
|
||||
|
You can assign a keyboard event to any control not just menus:
EVT_CHAR(control,callback function ) The callback function will examine the keypress (one of the event attributes) and will do something with it or pass it on for handling by another event handler. Typically the callback function will parse all key presses and only acts on the keys it is interested in - so you normally have a series of if ... elsif ... else statements. Note: you would probably attach the handler to a menu's parent to ensure your handler gets a chance to see the key press. grim;
__________________
*** Experimental Python Markup CGI V2 *** Last edited by Grim Archon : June 19th, 2004 at 11:18 AM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > wxPython + Keyboard Shortcut |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|