Re: anyone here yet?
- From: Shawn T Amundson <amundson cs umn edu>
- To: gtk-list redhat com
- Subject: Re: anyone here yet?
- Date: Thu, 1 May 1997 22:16:24 -0500 (CDT)
Words Of Owen Taylor:
>
>-------
>#!/usr/bin/perl -w
>
>use Gtk;
>
>Gtk::init ($0,\@ARGV);
>
>my $window = Gtk::window('toplevel');
>$window->connect("destroy", sub { Gtk::exit(0) });
>$window->border_width(10);
>
>my $button = Gtk::button_with_label("Hello World");
>$button->connect("clicked", sub { print "Hello World\n"; Gtk:exit(0) });
>$window->add($button);
>
>$button->show;
>$window->show;
>
>Gtk::main();
>
Personally, I prefer the following for perl. Also, PerlTk is an awesome
example of how to use the OO features of perl to their fullest.
--
use Gtk;
GtkInit($0,\@ARGV); # Export because the code is easier
my $window = GtkWindow('toplevel'); # to read. Export only when it is the
# right thing to do. It is the right
# thing here.
$window->connect("destroy", sub { GtkExit(0) };
# The next includes the "add" right along with the
# with, defining the parent right away, making use of
# the OO design a bit more. (This causes significant
# decrease in code.)
$button = $window->button_with_label("Hello World");
# Perhaps too, $button->reparent($newparent) a valid routine.
$button->show;
$window->show;
GtkMain();
--
Shawn T. Amundson University of Minnesota
Systems Administration Computer Science System Staff
amundson@cs.umn.edu http://www.cs.umn.edu/~amundson/
Count your friends, it won't take long; including yourself, you'll
find you only have one; you better have fun. -- Cathrine
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]