What you want is very hard to do, especially for a beginner. If you try and copy or clone the canvas, it will just overwrite the first at the exact locations on the screen. You are looking for some sort of deep object copying and blessing of the new object, and it dosn't work well with Tk. You might have some luck if you subclassed your Canvas, and used
Clone (or something similar) on it. But, it will probably be buggy at a very deep level, which would drive a beginner crazy. Your best bet, is to do either one of 2 things.
1. Every time you add or delete and object in 1 canvas, duplicate that move in the other, or maintain a log, and use the log to modify the other Canvas like an undo/redo script.
2. Stick to a single Canvas, and when you create 1 item in the Canvas, create another at an offset, to appear like in a second Canvas. Maybe have a key to prevent the cloning, or to erase from only a single canvas.
When you get into involved Canvas apps, you need to use the power of "tagging items". With creative-descriptive tagging, you can find and manipulate items easily.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.