If you read the docs on Tk::Menu under image you will see:
-image => value Specifies an image to display in the menu instead of a text string + or bitmap The image must have been created by some previous invocati +on of image create. This option overrides the -label and -bitmap opti +ons but may be reset to an empty string to enable a textual or bitmap + label to be displayed. This option is not available for separator or + tear-off entries.
Telling you to go look at the Tk::Image module to create the image.

If you want to use the 'images' from the Tk::Toolbar I think you will have to use the -bitmap option on the menu item rather than -image.

In addition, you have not used a geometry manager on your widgets in the code you showed us, so you wouldn't see anything anyway! Even the very simple example in Tk::Compound will give you some clues:

my $b = $parent->Button; my $c = $b->Compound; $b->configure(-image => $c); $c->Line; $c->Bitmap(-bitmap => 'warning'); $c->Space(-width => 8); $c->Text(-text => "Warning", -underline => 0); $b->pack;

jdtoronto


In reply to Re: Placement of image with Tk::Compound and Tk::Menu by jdtoronto
in thread Placement of image with Tk::Compound and Tk::Menu by ldln

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.