Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Tk add icon to popup menu

by IB2017 (Pilgrim)
on Jan 19, 2020 at 09:48 UTC ( #11111601=perlquestion: print w/replies, xml ) Need Help??

IB2017 has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks

this is surely a naive question, but me and Menus in Tk are not really good friends. How do I add an icon to a pop-menu contructed like this?

#use strict; use warnings; use Tk; my $mw = tkinit(); my $CkAutomaticBackUp; my $b1 = $mw->Button( -text => "Create pop-up", ); $b1->grid(-row => 0, -column => 1,); Popup($mw, $b1); $mw->MainLoop; sub Popup{ my ($mw, $obj) = @_; my $menu = $mw->Menu(-tearoff=>0, -menuitems=>[ [command=>"Something", -command=>[sub {print "Hello"}, $obj,]], ]); $obj->menu($menu); $obj->bind('<ButtonPress>', ['PostPopupMenu', Ev('X'), Ev('Y'), ]) +; return $obj; }

Replies are listed 'Best First'.
Re: Tk add icon to popup menu
by Anonymous Monk on Jan 19, 2020 at 20:36 UTC
      don't understand your question.
      you need to think out your question before ask.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11111601]
Approved by davies
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2020-02-28 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (123 votes). Check out past polls.

    Notices?