how to couper contenier of a canvas in an outer canvas???

Rick Johnson rantingrickjohnson at gmail.com
Thu Mar 14 18:24:51 EDT 2013


On Thursday, March 14, 2013 7:16:05 AM UTC-5, olsr.... at gmail.com wrote:
> how to couper all the obejcts in a canvas in an auther canvas?

Hmm, well before i can even start solving your problem, i'll need to spend some time figuring out what the hell you're problem is. o_O. "Maybe" you meant to say this:

> how to [copy] all the [canvas items] in [one] canvas [into another] canvas?

 "Ahhh, the sweet nectar of articulate communication!"

Why would you want to do that exactly? Hopefully you have a good reason. There are quite a few "canvas items" to consider:

    * arc objects
    * bitmap objects
    * image objects
    * line objects
    * oval objects
    * polygon objects
    * rectangle objects
    * text objects
    * window objects
    
There does not seem to be an easy way to do this via the Tkinter API (feel free to dig through the TCL/Tk docs if you like), however, if all you need to do is transfer a few simple primitives from one canvas to another, then the following (very general and admittedly quite naive) approach might get you there:

for object in canvas1
    # create newobject in canvas2
    # configure newobject 
    
But there are quite a few (very important) details that that little sample leaves out, for instance: tags, stacking orders, tag bindings, etc. 



More information about the Python-list mailing list