[Tutor] read-only Tkinter Entry Widget

rickp@telocity.com rickp@telocity.com
Wed, 7 Mar 2001 14:45:27 -0500


On Tue, Mar 06, 2001 at 09:09:28AM -0800, Daniel Yoo wrote:
> 
> The following code appears to be another way to do it:
> 
> ###
> from Tkinter import *
> root = Tk()
> mystr = StringVar()
> entry = Entry(textvariable=mystr, state=DISABLED).pack(side=LEFT)
> mystr.set('hello world')
> mainloop()
> ###
> 
> Because the widget's disabled, it won't listen to any keys.  However, it
> still allows copy and paste.  Tim, is this what you want?

My email got disrupted so I'm coming in a little late.

Several points.

1) The original question was about a *text* widget which does not
support a textvariable.

2) Since DISABLE causes the widget not to listen to any keys, how is
ctl-c supposed to work? I can still highlight with the mouse and then
paste the highlighted section into another field using the mouse but I
can't paste using ctl-v into another field.

-- 
"Every person who puts money into the hands of a 'government' (so
called), puts into its hands a sword which will be used against him,
to extort more money from him, and also to keep him in subjection to
its arbitrary will."
		-- Lysander Spooner
		   Rick Pasotto email: rickp@telocity.com