Placing entry widgets on a canvas in Tkinter

Mickel Grönroos mickel at csc.fi
Mon Jun 30 08:34:42 EDT 2003


Hi,

I'm trying to put an Tkinter.Entry of fixed size onto a specific location
on a canvas using the place manager. The idea is that one can double-click
a rectangle object on a canvas to get an entry field of the same size
as the rectangle placed exactly over the rectangle thus creating
the effect that the rectangle has entered "input mode". When clicking
return in the entry field, the value is fed back to a text object within
the rectangle object on the canvas.

Well, this works fine and well until the canvas is scrolled of one reason
or another. When that happens, the entry naturally does not follow the
canvas. Is there a way to lock a widget which is "placed" onto a canvas to
the canvas so that it follows the canvas as it scrolls or is rescaled? Or
do I have to implement a brand new set() method for the
scrollbar-canvas-relationship that not only scrolls the canvas, but also
moves the entry widget accordingly?

Or put it another way, does anybody have a better idea of how I can get a
fixed-size entry hovering over a rectangle object on a canvas than to use
the place geometry manager for placing an entry widget in that exact
location? (Don't tell me to just use text objects on the canvas as those
cannot be really fixed in width *and* height.)

Hope you can help.

Cheers,

/Mickel

--
Mickel Grönroos, application specialist, linguistics, Research support, CSC
PL 405 (Tekniikantie 15 a D), 02101 Espoo, Finland, phone +358-9-4572237
CSC is the Finnish IT center for science, www.csc.fi







More information about the Python-list mailing list