[Tutor] A few Questions

Kent Johnson kent_johnson at skillsoft.com
Sat Sep 4 14:12:20 CEST 2004


This depends on the GUI framework. Most frameworks have a way to "bind" key 
events to a callback function. The function that is bound to the events 
will be called when an event occurs.

In Tkinter, you can bind an event handler to a specific widget, to a 
window, to all instances of a widget class, or to the entire application. 
Which one you use depends on what you are trying to accomplish. For example 
if you want a text entry widget to respond in a special way to the enter 
key, you would bind to the specific widget with something like
textField.bind("<Return>", myEnterHandler)
where myEnterHandler is the name of your handler function.

On the other hand if you want to make the F1 key bring up help for your 
application, you would bind to the entire application using bind_all.

You can find more information on the event-handling page of Alan's tutorial 
or here:
http://www.pythonware.com/library/tkinter/introduction/events-and-bindings.htm

Kent

At 04:20 AM 9/4/2004 -0700, Ali Polatel wrote:
>thanks for all answers...
>Last question is
>How to catch keyboard events in GUI?
>Regards
>
>
>Do you Yahoo!?
><http://us.rd.yahoo.com/mail_us/taglines/10/*http://promotions.yahoo.com/new_mail/static/efficiency.html>New 
>and Improved Yahoo! Mail - Send 10MB messages!
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list