[Tutor] how to change the values of keyboard keys in TKINTER

Alan Gauld alan.gauld at btinternet.com
Mon Jan 14 19:08:52 CET 2008


"brindly sujith" <brindly at gmail.com> wrote

> i want to know how to change the values of keyboard keys(for 
> example:
> I want to set alt+f4 to enter)

Can you be more specific?
Do you want to change Alt-F4 for every application on the
computer permanently or only on a single application?
Do you want Alt-F4 to become the Enter key or just to
act like one in a specific scenario?

> do we have any modules in tkinter for doing this...

Not specifically but some of it can be faked.
See my event driven programming topic in my tutorial
for example code for reading the keys - including Alt-F4.

However its worth pointing out that this kind of stuff, and
the other things that you are posting are really well outside
what Tk was designed for.

The Tool Control Language(Tcl) was intended to be an
embedded macro language for various lab tools. Similar
to Python in that it is a scripting language which can easily
interface with other languages and be embedded in them.

The Tcl Toolkit (Tcl/Tk) was intended to allow a simple
GUI front end to be added to Tcl projects. It was never
really intended for writing complex GUI applications, it
provides basic GUI capability in a very easy to use package.

Tkinter is a thin Python wrapper around Tcl/Tk and has
much the same purpose - to provide basic GUI wrapper
capability in an easy to use package. It is not a fully
featured GUI system like MS Windows or X windows.

If you want to do lots of low level control of a GUI you
would be better advised to look at toolkits like PyQt or
GTK. Even wxPython struggles to provide the low level
detailed control that you are looking for.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list