in reply to Re^5: Gtk2: main window visibility
in thread Gtk2: main window visibility

I was thinking today, can I use this program in windows or is there some other module that I should use?

Replies are listed 'Best First'.
Re^7: Gtk2: main window visibility
by zentara (Cardinal) on Aug 01, 2007 at 12:10 UTC
    There is the hassle of installing Gtk2 on windows. You might want to look at the Win32 modules for an alternative. See Statusbar icon "shell" to hide console window? and here is a script I have (I found it somewhere, maybe here). Untested:
    #!/usr/bin/perl use warnings; use strict; #The function name is defined as "Win32::GUI::NotifyIcon". #You will need to be carefull about the order of your sub... #Here a sample script to let's you see, just choose a nice win32 ico a +nd #name it god.ico in the same dir from where you will launch this scrip +t: #--------------- BEGIN{ use Win32::Console; Win32::Console::Free(); } use Win32::GUI; use Tk; $mw = MainWindow -> new; $mw -> wm('geometry', '0x0+0+0'); $mw->overrideredirect(1); &do_win32_stuff; MainLoop; #-------------------------------- sub do_win32_stuff{ $mw_win32 = new Win32::GUI::DialogBox( -width => 0, -height => 0, -name => 'MainWindow'); $icon = new Win32::GUI::Icon('god.ico'); new Win32::GUI::NotifyIcon( $mw_win32, -name => "Notify", -id => 1, -icon => $icon, -tip => "I\'am in the Systray!"); $call = Win32::GUI::Dialog(); $mw_win32->Notify->Delete(-id => 1); sub Notify_Click{ &my_menu; } } #-------------------------------- sub my_menu{ $popup = $mw->Menu(Name => 'popupMenu', -tearoff => 0); $popup->command(-label => 'Number 1',-command => [\&do_label,1] ); $popup->command(-label => 'Number 2',-command => [\&do_label,2]); $popup->separator; $popup->command(-label => 'Number 3', -command => [\&do_label,3]); $popup->command(-label => 'Number 4', -command => [\&do_label,4]); $popup->command(-label => 'Number 5', -command => [\&do_label,5]); $popup->separator; $popup->command(-label => 'Quit', -command => [ \&stop]); $popup->Popup(-popover => 'cursor', -popanchor => 'nw'); } #-------------------------------- sub stop{ exit; } #-------------------------------- sub do_label{ if(Exists($top)){ $label-> configure(-text => "I\'am $_[0]"); } else { $top = $mw ->Toplevel; $top->title(" Numbers"); $top->focus; $label = $top->Label (-text => "I\'am $_[0]", -relief => 'groove', -width => '24')->pack; } }

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
      Could it be possible to use Par on linux to make an executable that will run on windows?
        I have never played with Par, (esp for Win32) so you may want to ask this as a separate node. One thing that I "think" will pose a problem, is if Par will also include the underlying Gtk2 c libs in a manner that will work on Win32. There are 2 levels of Gtk2..... you have the base c libs for each platform, then you have the Perl modules which interface those c libs. I don't know what Par does about the underlying c-libs, you will probably have an easier time running Par on Win32, for Win32.

        Wouldn't it be nice if it was as easy as you suggest? You really should ask this on the Perl/Gtk2 maillist, the people who use it in Win32 frequent that list.


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