Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Windows/Linux System Tray and tk

by zentara (Archbishop)
on Jul 14, 2007 at 12:07 UTC ( #626617=note: print w/ replies, xml ) Need Help??


in reply to Windows/Linux System Tray and tk

Well just for your information, Gtk2 has the ability

#!/usr/bin/perl use warnings; use strict; use Gtk2::TrayIcon; Gtk2->init; my $icon= Gtk2::TrayIcon->new("test"); $icon->add( Gtk2::Label->new("test") ); $icon->show_all; Gtk2->main;
See Wooty for a little more pizazz.

Now Gtk2 and Tk mainloops can be made to work together, so that may give you an option. Basically, you make a Tk timer to update the Gtk2 loop every 10 millisecs. You can do the reverse too .... let a Gtk2 timer do a $mw->update every so often.

#!/usr/bin/perl -w use strict; use Gtk2; use Tk; my $mw = MainWindow->new(-title=>'Tk Window'); Gtk2->init; my $window = Gtk2::Window->new('toplevel'); $window->set_title('Gtk2 Window'); my $glabel = Gtk2::Label->new("This is a Gtk2 Label"); $window->add($glabel); $window->show_all; my $tktimer = $mw->repeat(10, sub{ Gtk2->main_iteration while Gtk2->events_pending; }); $mw->Button(-text=>' Quit ', -command => sub{exit} )->pack(); MainLoop;

I'm not really a human, but I play one on earth. Cogito ergo sum a bum


Comment on Re: Windows/Linux System Tray and tk
Select or Download Code
Re^2: Windows/Linux System Tray and tk
by deadpickle (Pilgrim) on Jul 15, 2007 at 20:12 UTC
    I was going to try and test Gtk2::TrayIcon. I went to install the module and recieved this error:
    CPAN.pm: Going to build T/TS/TSCH/Gtk2-1.145.tar.gz *** can not find package gtk+-2.0 >= 2.0.0 *** check that it is properly installed and available in PKG_CONFIG_PA +TH at Makefile.PL line 67 Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=s +ite] TSCH/Gtk2-1.145.tar.gz /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK Running make test Make had some problems, won't test Running make install Make had some problems, won't install Failed during this command: TSCH/Gtk2-1.145.tar.gz : writemakefile NO '/usr +/bin/perl Makefile.PL INSTALLDIRS=site' returned status 2304
    I believe that Gtk2 is installed since I have ran programs that used it before. Any ideas on how to fix this?
      Perl/Gtk2 is based on the c Gtk2 libs, so you need to install the c libs before the Perl modules that interface to them. Your linux distribution may have the runtime Gtk2 (Gnome libs) as a separate package, with the "devel libs" in another rpm (or whatever). SO if you can run Gtk2 programs, but can't compile them, install the "gtk2-gnome devel" package.

      If that is not possible, get the c libs yourself See Perl/Gtk2 Faq

      The basic libs are only needed, not the entire Gnome library set. They must be installed in a certain order

      pkgconfig cairo glib pango atk gtk2
      You usually have to keep the same pkgconfig location.... defaults to /usr/local, but it's easiest to keep them in /usr, so when you configure them, do
      ./configure --prefix=/usr

      Get the latest versions from Gtk+ downloads then install in the order above, then install the Perl modules in the same order.


      I'm not really a human, but I play one on earth. Cogito ergo sum a bum
        Simply enough, I did not think of looking in the Synaptic Package Manager. Ubuntu 7.04 includes this Perl Module in the SPM.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://626617]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-10-22 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (117 votes), past polls