X-Chat, Gtk-Perl
- From: André <andrerm vento com br>
- To: gtk-perl-list gnome org
- Subject: X-Chat, Gtk-Perl
- Date: Tue, 21 Nov 2000 00:43:30 -0200
Hi,
i'm making a prel script for X-Chat and i can't make this work:
#!/usr/bin/perl -w
#
#
#
IRC::register("my script", "1.0", "", "");
IRC::add_command_handler("command", "my_command");
IRC::print("My Script ready.\n");
use Gtk; # carrega o módulo GTK-Perl
use strict;
init Gtk; # inicializa o módulo Gtk-Perl
set_locale Gtk; # suporte à internacionalização
# GTK-Perl prompt dialog (test)
sub gtk_input
{
# 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", sub { $window->destry(); } );
$button->signal_connect( "clicked", sub { $window->destry(); } );
# show button
$button->show();
# window's size is program controlled
$window->set_policy( $false, $false, $true );
# set window attributes and show it
$window->set_modal( $true );
$window->set_position( 'center' );
$window->border_width( 15 );
$window->add( $button );
$window->show();
# Gtk event loop
main Gtk;
# Get data from entry box and return
return 1;
}
# X-Chat command
sub my_command
{
my $s = gtk_input();
IRC::print($s);
return 1;
}
X-Chat quit without seg foult when I click Goodbye button. Why? If I
comment "main Gtk" the sub return after the window is opened. I'm new
with Gtk and perl... how can I make it work?
Thanks,
Andrew
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]