Re: Tastatureingaben anfragen
Verfasst: Mittwoch 25. April 2018, 12:00
Hi markjohannes
Ich nehme an die vergangenen Antworten haben noch nicht ganz zum Ziel geführt? Hier etwas für Tkinter:Gruss wuf 
Ich nehme an die vergangenen Antworten haben noch nicht ganz zum Ziel geführt? Hier etwas für Tkinter:
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
#~~ For Python 2.x
import Tkinter as tk
except ImportError:
#~~ For Python 3.x
import tkinter as tk
def taste_gedrueckt(event):
taste_char = event.char
taste_code = event.keycode
taste_symbol = event.keysym
taste_num = event.keysym_num
print("\nFolgende Taste wurde gedrückt:"\
+ "\nChar:{}\nCode:{}\nSymbol:{}\nNummer:{}".format(
taste_char, taste_code, taste_symbol, taste_num))
app_win.title("Tasten Symbol: {}".format(taste_symbol))
app_win = tk.Tk()
app_win.title("Bitte Taste drücken")
app_win.geometry("300x100")
app_win.bind('<KeyPress>', taste_gedrueckt)
app_win.mainloop()
