Re: Gtk->main

I ran this code on an Intel box running RedHat 7.1 (+Ximian Gnome) with
ActivePerl 5.6.1 using the Gtk-Perl-0.7007 module and had no problems at
all.  What is your setup?  Perhaps you have a buggy version of Gtk-Perl?

On 09 Jun 2001 14:40:21 -0500, Eric wrote:
#!/usr/bin/perl -w

use Gtk;         # load the Gtk-Perl module
use strict;      # a good idea for all non-trivial Perl scripts

init Gtk;        # initialize Gtk-Perl
set_locale Gtk;  # internationalize

# convenience variables for true and false
my $false = 0;
my $true = 1;

# widget creation
my $window = new Gtk::Window( "toplevel" );
my $button = new Gtk::Button( "Goodbye World" );

# callback registration
$window->signal_connect( "delete_event", \&CloseAppWindow );   
$button->signal_connect( "clicked", \&CloseAppWindow );

# show button

# set window attributes and show it
$window->border_width( 15 );
$window->add( $button );

# Gtk event loop
main Gtk;

# Should never get here
exit( 0 );

### Callback function to close the window
sub CloseAppWindow
    Gtk->exit( 0 );
    return $false;
Today is Sweetmorn, the 15th day of Confusion in the YOLD 3167

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]