OCESS / orbitx

Rewrite of OrbitV, maintained by Patrick, Gavin, and contributors
MIT License
10 stars 18 forks source link

ENG: Keyboard Bindings #110

Open StefanDeYoung opened 4 years ago

StefanDeYoung commented 4 years ago
  1. Catalog all of the existing keybindings in OrbitV
  2. Add keyboard bindings to eng_gui
pmelanson commented 4 years ago

Added a text file of the keys that hopefully can be easily changed into an "if elif elif elif" or similar block.

StefanDeYoung commented 4 years ago

Excellent! In terms of writing the elif chain, I think it would look like this:

def keybinds(event):
    if event.char.lower() == 'a':
        my_function()
   elif event.char.lower() == 'b':
        my_other_function()

button = tk.Button(parent)
button.bind("<Key>", keybinds)
button.pack()