Greetings meisters and monks! I've lurked around this place for many years, each time I've taken on a Perl project. Sadly I was born in America and not Europe where they actually value education, and so am expected to go tens of thousands of dollars into debt to learn anything, leaving me with the internet and late fees at the public library as my only affordable or equitable path to knowledge.
Recently I have been attempting a simple application that uses a Canvas to create a background image, then places some additional sized canvases around on top of it as pseudo buttons, bound to mouse events, with image backgrounds over them so that they blend in with the main canvas background.
So, first I define the main canvas and background.
my $maincanvas = $mw-> Canvas(-highlightthickness => 0);
my $maincanvasi = $mw-> Photo(-file => "$img.jpg");
$maincanvas->createImage(0,0, -image => $maincanvasi, -anchor => 'nw')
+;
Then I make the various sub-canvas pseudo buttons (because bind wants a widget and canvas allows a background image):
my $subcanvas1 = $maincanvas-> Canvas(-width => 64, -height => 54, -hi
+ghlightthickness => 0);
my $subcanvas1i = $maincanvas->Photo(-file => "$button1.jpg");
$subcanvas1-> form(-left => '420', -top => '444');
$subcanvas1-> createImage(0, 0, -image => $subcanvas1i, -anchor => 'nw
+');
Further down I bind these sub-canvas buttons to mouse events:
$subcanvas1-> Tk::bind('<Button-1>' => sub { dostuff } );
Later in the script I want to be able to mass-delete and formForget all of these sub-canvas objects. However, when I attempt to do this to an array containing the names of all these psuedo button canvas objects like this:
foreach (@canvasbuttons) { $_->delete('all'); $_->formForget; }
...Perl complains at me saying:
Tk::Error: Window "<yada>" is not managed by the tixForm manager...
...
<ButtonRelease-1>
(command bound to event)
So, my question is, how can I mass-unbind all these sub-canvas canvas psuedo buttons and unpack them?
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.