I am writing a small tkinter-app involving user keyboard-input, and want to control the range of acceptable input-characters. I'm currently using an Entry-widget, but haven't been able to access the individual characters AS THEY ARE ENTERED. What I (think I:confused:) need is somthing like the 'command=' option (as in the Button-widget), which would call a function at each keyboard-entry. Can anyone point me in the right direction? Thanks.
shr2408
0
Newbie Poster
Recommended Answers
Jump to PostThis should help you ...
# bind and show a key event with Tkinter from Tkinter import * root = Tk() prompt = ' Press any key ' label1 = Label(root, text=prompt, width=len(prompt)) label1.pack() def key(event): if event.char == event.keysym: msg = 'Normal Key %r' % event.char …
Jump to PostCan you give us the whole class?
Just a note, 'l00' is a heck of a variable name, looks a lot like the number '100', I would avoid it!
Jump to PostIf crWidg is not 0, then your self.l00 label is never created. Hence your AttributeError. The instance prefix self. makes that variable global to the class methods.
All 11 Replies
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
shr2408
0
Newbie Poster
shr2408
0
Newbie Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
shr2408
0
Newbie Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
shr2408
0
Newbie Poster
Ene Uran
638
Posting Virtuoso
shr2408
0
Newbie Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
shr2408
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.