Tkinter Event Types

tiissa tiissa at nonfree.fr
Mon Apr 18 17:15:34 EDT 2005


codecraig wrote:
> Hi,
>   When I do something like.
> 
> s = Scale(master)
> s.bind("<ENTER>", callback)
> 
> def callback(self, event):
>     print event.type
> 
> I see "7" printed out.  Where are these constants defined for various
> event types?  Basically i want to do something like...
7 must be for KeyPressed.
That's the type of the event (among Activate, Button, KeyPressed...).

> 
> def callback(self, event):
>     if event.type == ENTER:
>         print "You entered"

You may want to look at event.keycode (36 for Return).




More information about the Python-list mailing list