События Tkinter KeyPress и KeyRelease ⇐ Python
События Tkinter KeyPress и KeyRelease
I understood that the Tk keypress and keyrelease events were supposed only to fire when the key was actually pressed or released?
However with the following simple code, if I hold down the "a" key I get a continual sequence of alternating keypress/keyrelease events.
Am I doing something wrong or is TkInter buggy? This is Python2.7 on Linux mint.
from Tkinter import * def keyup(e): print 'up', e.char def keydown(e): print 'down', e.char root = Tk() frame = Frame(root, width=100, height=100) frame.bind("", keydown) frame.bind("", keyup) frame.pack() frame.focus_set() root.mainloop() Output when pressing and holding "a":
down a up a down a up a down a up a down a up a etc...
Источник: https://stackoverflow.com/questions/272 ... ase-events
I understood that the Tk keypress and keyrelease events were supposed only to fire when the key was actually pressed or released?
However with the following simple code, if I hold down the "a" key I get a continual sequence of alternating keypress/keyrelease events.
Am I doing something wrong or is TkInter buggy? This is Python2.7 on Linux mint.
from Tkinter import * def keyup(e): print 'up', e.char def keydown(e): print 'down', e.char root = Tk() frame = Frame(root, width=100, height=100) frame.bind("", keydown) frame.bind("", keyup) frame.pack() frame.focus_set() root.mainloop() Output when pressing and holding "a":
down a up a down a up a down a up a down a up a etc...
Источник: https://stackoverflow.com/questions/272 ... ase-events
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Клюки, Keydown и Keypress события не работают на мобильных устройствах
Anonymous » » в форуме Jquery - 0 Ответы
- 4 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Клюки, Keydown и Keypress события не работают на мобильных устройствах
Anonymous » » в форуме Jquery - 0 Ответы
- 4 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Клюки, Keydown и Keypress события не работают на мобильных устройствах
Anonymous » » в форуме Jquery - 0 Ответы
- 4 Просмотры
-
Последнее сообщение Anonymous
-