Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

tk menu icons slow

by Anonymous Monk
on Nov 19, 2015 at 18:43 UTC ( [id://1148143]=perlquestion: print w/replies, xml ) Need Help??

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

Dear Monks

I'm trying to understand if the folowing is a general issue with the TK Menu, or just a problem I am experiencing. I have a menu with icons: when opening a menu by clicking upon its name, the menu opens fast, but if I move from an opend menu to the next one, just moving the mouse from the first to the second menu, the second menu is displayed quite slowing, building an impage after the other (from the top to the bottom). Here is the script (images must be of course saved locally)

#!perl use strict; use warnings; use utf8; use Tk; use Tk::Menu; use Tk::Photo; use Tk::PNG; my $mw = Tk::MainWindow->new(); my $menuitems = [ [Cascade => "~File", -menuitems => [ [Button => "~Neu", -command => \&new, -image => $mw->Photo(-file => '1.png'), -compound => 'left', ], [Separator => ""], [Button => "~Hilfe", -command => \&open, -image => $mw->Photo(-file => '2.png'), -compound => 'left', ], [Button => "~Schließen", -command => sub{ exit(0); }, -image => $mw->Photo(-file => '3.png'), -compound => 'left', ], ], ], [Cascade => "~Options", -menuitems => [ [Button => "~Neu", -command => \&new, -image => $mw->Photo(-file => '1.png'), -compound => 'left', ], [Separator => ""], [Button => "~Hilfe", -command => \&open, -image => $mw->Photo(-file => '2.png'), -compound => 'left', ], [Button => "~Schließen", -command => sub{ exit(0); }, -image => $mw->Photo(-file => '3.png'), -compound => 'left', ], ], ], ]; my $menu = $mw->Menu(-menuitems => $menuitems); $mw->configure(-menu => $menu); $mw->MainLoop();

Any idea?

Replies are listed 'Best First'.
Re: tk menu icons slow
by SuicideJunkie (Vicar) on Nov 19, 2015 at 20:47 UTC

    I'm not seeing any slowdown on my desktop.

    I've got a simplified classic scheme however. Perhaps try looking into desktop effects and theme features like menu animations. Toggle any features off and see if one of them causes it.

    PS:
    Oh, it might also be something to do with the individual images. Presumably the two actual menus aren't both using the same three images, and they definitely aren't using the random image I grabbed for the task.

    PPS:
    You can embed an image in your source, for example:

    #Embedding GIF bytes: my $icon = pack('C*' ,71,73,70,56,57,97,64,...(Many more bytes)...,0,5 +9); my $img = Tkx::image_create_photo(-data => $icon); $mw->g_wm_iconphoto($img);

Re: tk menu icons slow
by Anonymous Monk on Nov 20, 2015 at 00:49 UTC

    Any idea?

    What version? What kind of files?

    I don't see any slowdown on windows using Tk 804.030 and these files i just pbrushed

    $ file 1.png 2.png 3.png 1.png; PC bitmap, Windows 3.x format, 32 x 32 x 24 2.png; PC bitmap, Windows 3.x format, 32 x 32 x 24 3.png; PC bitmap, Windows 3.x format, 32 x 32 x 24

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1148143]
Approved by stevieb
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 05:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found