SMarcell
(usa Slackware)
Enviado em 02/09/2010 - 08:56h
Veja esses exemplos do famoso 'Hello, World!' em GTK, e tire suas conclusões:
Python:
import pygtk
pygtk.require('2.0')
import gtk
class HelloWorld:
.....def destroy(self, widget, data=None):
.........gtk.main_quit()
.....def __init__(self):
.........self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
.........self.window.connect("destroy", self.destroy)
.........self.window.set_border_width(10)
.........self.button = gtk.Button("Hello, World!")
.........self.button.connect_object("clicked", gtk.Widget.destroy, self.window)
.........self.window.add(self.button)
.........self.button.show()
.........self.window.show()
.....def main(self):
.........gtk.main()
if __name__ == "__main__":
.....hello = HelloWorld()
.....hello.main()
============================
Perl:
use Gtk2;
Gtk2->init;
my $window = Gtk2::Window->new ('toplevel');
my $button = Gtk2::Button->new ('Hello, World!');
$button->signal_connect (clicked => sub { Gtk2->main_quit });
$window->set_border_width(10);
$window->add ($button);
$window->show_all;
Gtk2->main;