[tkinter] two questions regarding Canvas
Joseph Robertson
jmrober1 at ingr.com
Wed Jun 2 13:12:34 EDT 1999
Sure does, heres some relevant clips. Sorry I couldn't send the whole
thing but its too big.
I have a class that creates the canvas, then I set the binding:
def __init__(self)
...
self.canvas.bind('<Button-1>', self.CellClick)
...
Heres the working method:
def CellClick(self, event):
self.canvas.delete('rect')
cellbbox = self.canvas.bbox('current')
self.canvas.create_rectangle(cellbbox, outline='blue',
tags='rect')
Now I don't have it editable yet, I am using this,
item = self.canvas.create_text(xpos, ypos, text=field, font=self.f)
in a loop to put data onto the canvas.
I'm sure that creating a hidden Entry and the moving it and making it
visible would work fine, or don't move it and make a 'status line' type
of data editing, like Lotus did.
Good Luck,
Joe
mlauer at amalia-atm.rz.uni-frankfurt.de wrote:
> Howdy, though I'm gaining knowledge through
> browsing through all the available documentation
> (that is, the tkinter life-preserver, tkinter.py
> and the tk/tcl documentation) some things
> remain misterious...
>
> For instance:
>
> a) Does the tk Canvas support "inplace" editing of
> text items or what are the functions Canvas.icursor
> and Canvas.focus for ? If so, how ? For instance,
> binding the <Any-Enter> to a text item function,
> which sets icursor and focus doesn't work for me
> (yes, the canvas has the current focus)
>
> b) Does the Canvas support a visible selection
> of items (such as a boundaring rectangle or so)
> on its own or have I to do this via binding <Any-Enter>
> and <Any-Leave> ?
>
> Have a nice day!
>
> --
> Regards & Gruesse from Mickey @ http://www.Vanille.de
> ---------------------------------------------------------
> How could anyone know me - when I don't even know myself ?
More information about the Python-list
mailing list