in reply to Menubar checkbutton to show state?

To be honest, Tk is not very good at accessing the window manager's statusbar, but Gtk2 is. The example below, is a Tk program, which you can place wherever you want as an indicator. For Gtk2, see Gtk2::StatusIcon Demo ( which may not work on all WindowManagers :-( )
#!/usr/bin/perl use Tk; use strict; my $mw = MainWindow->new; $mw->geometry('20x20-20-20'); $mw->overrideredirect(1); # make right mouse button click an exit $mw->bind( '<3>' => sub{ exit } ); my @color = qw/red lightgray/; my $bits = pack("b8"x8, "...11...", "..1111..", ".111111.", "11111111", "11111111", ".111111.", "..1111..", "...11...",); $mw->DefineBitmap('indicator' => 8,8, $bits); my $label = $mw->Label(-bitmap=>'indicator', -fg=>'red', -bg => 'black +') ->pack( -fill=>'both', -expand=>1); $mw->repeat(500,sub{$label->configure( -fg=>$color[0]); @color=reverse(@color); }); MainLoop;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku

Replies are listed 'Best First'.
Re^2: Menubar checkbutton to show state?
by swe9 (Initiate) on Aug 19, 2010 at 19:58 UTC
    Thanks for the responses! I'll have to try things out and see if I can make it work.