bind in Tkinter
Shankar Iyer (siyer@Princeton.EDU)
siyer at Princeton.EDU
Fri Jun 10 17:15:20 EDT 2005
Thanks!
Your message guided me to the solution to my problem.
Shankar
----- Original Message -----
From: Markus Weihs <mweihs at gmx.at>
Date: Friday, June 10, 2005 5:01 pm
Subject: Re: bind in Tkinter
> Hi!
>
> If you press a key, a key-event is passed to the function, here to
> self.quit. This is the misterious second argument, which can be
> useful if you e.g. want to check which key was pressed. Here is
> a snippet to show how you can do it:
>
>
> from Tkinter import *
>
> def quit_program(event):
> print event.keysym # which key was pressed?
> root.quit()
>
> root = Tk()
> e = Entry()
> e.bind("<Return>", quit_program)
> e.pack()
> root.mainloop()
>
>
> Regards, mawe
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list