[Tutor] Tkinter and keyboard output
Igor Riabtchuk
igor.r at vodafone.net
Thu Mar 24 19:05:25 CET 2005
Hi,
I was playing around with Tkinter bindings and I got a question which is probably not particularly bright.
If I have the following code, it works because I specifically code a function for <Alt-p> keypress:
from Tkinter import *
class CRED(Frame):
def __init__(self):
Frame.__init__(self)
self.txt=Text(self)
self.txt.bind('<Alt-p>', self.conv)
self.txt.pack()
self.pack()
self.txt.focus()
def conv(self,event):
self.txt.insert(END,'t')
return 'break'
app=CRED()
app.mainloop()
What if instead of coding <Alt-p>, I coded <Alt-Key> - how would I implement the function which would allow the code to determine which 'Key' was pressed after Alt?
Thank you.
Igor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050324/3e6b0b5c/attachment.html
More information about the Tutor
mailing list