File: simple.pl

package info (click to toggle)
libgtk-perl 0.1.17-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 1,352 kB
  • ctags: 1,100
  • sloc: ansic: 4,393; perl: 3,463; makefile: 36
file content (33 lines) | stat: -rw-r--r-- 673 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use Gtk;

use vars qw($window $button $button2);

sub hello {
	Gtk->print("hello world\n");
	print "Destroying $button and $window\n";
	destroy $button;
	destroy $window;
	$button = undef;
	$window = undef;
}

init Gtk;

$window = new Gtk::Widget	"GtkWindow",
		GtkObject::user_data		=>	undef,
		GtkWindow::type			=>	-toplevel,
		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;