[Tutor] Perl/Tk

alan.gauld@bt.com alan.gauld@bt.com
Mon, 22 Jan 2001 16:55:02 -0000


Those of a nervous disposition should avert their eyes now,
here is some Tkinter equivalent code in Perl/Tk...

Tkinter:
=================
from Tkinter import *
import sys
main = Tk()
Button(main, text="Hello world", command=sys.exit).pack()
mainloop()

Perl/Tk:
=================
use Tk;
my $main = Mainwindow->new;
$main->Button(-text=>"Hello World", -command=>sub{exit})->pack;
MainLoop;


Its pretty similar, more OO than I remembered.

HTH somebody ;-)

Alan g.