[Tutor] blocking user access
John Fouhy
jfouhy at paradise.net.nz
Wed Mar 23 21:17:13 CET 2005
Diana Hawksworth wrote:
> Hi! I need help on blocking user access to a message box - for example,
> the program could provide an answer to an input. At the moment, the
> user has access to - and can type into - that "answer" space. How do I
> prevent that from happening please?
Are you using Tkinter?
You could bind '<Key>' to nothing in the entry widget. eg:
self.answer = Tkinter.Entry(master)
def noop(e):
return 'break'
self.answer.bind('<Key>', noop)
--- actually, scratch that. For Tkinter, just make the widget disabled.
self.answer.config(state=Tkinter.DISABLED)
Just remember that it needs to be enabled when you put the answer in.
--
John.
More information about the Tutor
mailing list