Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Answer: How do I change the icon on Toplevel?

by Anonymous Monk
on Nov 10, 2003 at 15:38 UTC ( #305894=categorized answer: print w/replies, xml ) Need Help??

Q&A > GUI Programming > How do I change the icon on Toplevel? - Answer contributed by Anonymous Monk

# define the icon's data: my $my_icon_data = <<'EOF'; /* XPM */ static char *main[]={ "32 32 3 1", "# c #1655fe", ". c #ffffff", "$ c #fbc819", "................................", "................#...............", . ...the rest of your really cool pixel art here... . "......####............####......", "......####............####......",}; EOF # associate that with the image name 'my_icon': $main->Pixmap( 'my_icon', -data => $my_icon_data ); # use the image as an icon on any TopLevel: $toplevel->Icon( -image => 'my_icon' );

I've tested the above in Windows XP and Linux.

See Tk::Pixmap for info on XPM files.

Replies are listed 'Best First'.
Re: Answer: How do I change the icon on Toplevel?
by batkins (Chaplain) on Nov 10, 2003 at 16:26 UTC
    What a convoluted mess. All you do is:
    my $img = $tl->Photo(-file => "path_to_image"); $tl->Icon(-image => $img);
    And substitute a Pixmap or Image for the Photo if necessary.

    Are you sure it was a book? Are you sure it wasn't.....nothing?
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[GotToBTru]: un less you're working on write-only memory
[1nickt]: my $x = $aohoaoh->[0]->{' foo'}->[0]->{'bar' }; should work
[thepkd]: not indexing
[thepkd]: getting data out of the ds
[choroba]: it depends. Give more details, please
[thepkd]: i used a series of {}'s but it dont work
[choroba]: You need square brackets for arrays
[GotToBTru]: you can certainly construct a single expression to access any part of the data structure, without using temp variables. but you might make it easier on yourself and any other poor soul who has to understand your code if you do
[thepkd]: to dereference i mean
LanX .oO( oh tempz, oh moretz)

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (14)
As of 2016-12-06 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (104 votes). Check out past polls.