Numeric Entry in Tkinter

Dustan DustanGroups at gmail.com
Sun Jan 22 21:24:46 EST 2006


Earlier I asked about limitting what a user can enter in an Entry. I
got a few greatly appreciated replies, but I was hoping it would be
possible to take a more direct approach, that is, is there a method I
can override, when creating a class that inherits the Entry methods,
that is called whenever the user enters a key? I'm thinking something
like this in the override version:

def method(self, key):
    if key in "1234567890":
        Entry.method(self, key)
    else:
        pass

Is this possible? I suppose key would actually be accessed using an
associated get() method or something of the sort, but you get the idea.
Is there such a method?




More information about the Python-list mailing list