Tkinter.Text & not inputting text...

Gorny gorny at hobbiton.org
Sat Sep 8 07:30:29 EDT 2001


> How do I make a Tkinter.Text() object that doesn't allow
> the user of the program to input text but only the program???

Whoa I found one anwser but there may be some more and even
better (?) solutions...:)

http://www.faqts.com/knowledge_base/view.phtml/aid/4927/fid/264

from Tkinter import *
root=Tk()
text=Text(root,width=50,height=50)
text.pack()
def intercept(event):
    return 'break'
text.bind('<Key>',intercept)
text.insert(END,'Sweet ;-)')
root.mainloop()

Bye,
Gorny


--
"When I was a little kid, I had this dream where a snake would rule and
dominate the entire world (actually, I guess that a penguin was also part of
the dream... but never mind)" -- Python Develper's Handbook, Andre Lessa
http://gorny.cjb.net








More information about the Python-list mailing list