This subject came up on the DaniWeb Python discussion board,
and I was
curious about it:
(http://www.daniweb.com/techtalkforums/thread70746.html
)
The issue is an apparent difference between PCs and Macs in
interpreting key holds. The following code:
---
from Tkinter import *
class MyFrame(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.go = False
self.bind('<a>', self.showJudgments)
self.bind('<KeyRelease-a>', self.makeChoice)
self.pack(expand=YES, fill=BOTH)
self.focus_force()
def showJudgments(self, event=None):
if self.go == False:
self.go = True
self.showJudgmentsA()
else:
self.keepShowing()
def keepShowing(self):
print 'a key being pressed'
def showJudgmentsA(self):
print "key-press started"
def makeChoice(self, event=None):
print "choice made"
self.go = False
mainw = Tk()
mainw.f = MyFrame(mainw)
mainw.f.grid()
mainw.mainloop()
---
on a PC produces this output:
---
key-press started # pressed 'a' here
a key being pressed
a key being pressed
...
a key being pressed
choice made # let go here
---
and on a Mac, this output:
---
key-press started
choice made
key-press started
choice made
key-press started
choice made
key-press started
choice made
---
Apparently, Macs interpret held keys as press/release,
press/release, ...
Is this correct?
Thanks,
Jeff
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
a>
|