Python Forum
[Tkinter] Control the application using the keyboard
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Control the application using the keyboard
#1
Hello,
I have a problem with key control in my tkinter app. After pressing the key ("Enter", →, ←, +, Ctrl+S) I want to do my function. How do I set this control after pressing these keys? For example here is the scheme of the program (not my app):
from tkinter import*
app = Tk()

def MyFunction(x):   #I want to do this after pressing "Enter"
    print(x)

def MyFunction2(y):   #I want to do this after pressing "→"
    y = y + 1
    return y

def MyFunction3(z):   #I want to do this after pressing "Ctrl+S"
    return z**2

def MyFunction4(a):   #I want to do this after pressing "+"
    print(z*2)

app.mainloop()
Reply


Messages In This Thread
Control the application using the keyboard - by Christina - Sep-21-2019, 10:28 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020