Re: [gtk-list] Re: Gtk & Perl
- From: "Shawn T. Amundson" <amundson CompleteIS com>
- To: Kenneth Albanowski <kjahds kjahds com>
- cc: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Gtk & Perl
- Date: Sun, 17 Aug 1997 11:50:49 -0500 (CDT)
On Sun, 17 Aug 1997, Kenneth Albanowski wrote:
>
> Mine is definitely functional, though I do get some interesting crashses
> every now and then. I apologize for not asking whether anyone else was
> working on such a project, but I more or less started the thing on a lark,
> and it just got out of hand. :-)
>
Cool...
> Of course, even with these limitations, much is possible. This is my
> translation of 970606's simple.c:
>
> use Gtk;
>
> use vars qw($window $button);
>
> sub hello {
> Gtk->print("hello world\n");
> }
>
> $window = new Gtk::Widget "GtkWindow",
> GtkObject::user_data => undef,
> GtkWindow::type => 0,
> GtkWindow::title => "hello world",
> GtkWindow::allow_grow => 0,
> GtkWindow::allow_shrink => 0,
> GtkContainer::border_width => 10;
>
> $button = new Gtk::Widget "GtkButton",
> GtkButton::label => "hello world",
> GtkObject::signal::clicked => "hello",
> GtkWidget::parent => $window,
> GtkWidget::visible => 1;
>
> show $window;
>
> main Gtk;
>
Something like the below is *much* better for Perl:
use Glib; # Exports g_print, etc.
use Gtk; # Only exports GtkMainLoop()
my $app = new Gtk::Application;
my $window = $app->Window(
-user_data => undef,
-type => 0,
-title => 'hello world',
-allow_grow => 0,
-allow_shrink => 0,
-border_width => 10
);
my $button = $app->Button( # Should allow $window->Button to rid -parent arg
-label => 'hello world',
-sig_clicked => sub { g_print "hello world\n"; },
-parent => $window,
-visible => 1
);
$window->show;
GtkMainLoop $app;
>
> I'll mail you a copy -- it's not too large.
>
Please me too. I'd recommend letting the whole list at it for a week or
so before you put it up on CPAN. ;-)
--
Shawn T. Amundson Complete Internet Solutions
Senior Systems Administrator Minneapolis, Minnesota, USA
amundson@CompleteIS.com http://www.CompleteIS.com/~amundson
while (i) { last }
i, do exist.
forever;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]