Permalink
Browse files

Add a Tk example (not yet working)

  • Loading branch information...
1 parent bc0e8b1 commit d1f979cb3f45acadcd6a2f91fdb37cafd01358f1 @sorear sorear committed Apr 1, 2010
Showing with 20 additions and 0 deletions.
  1. +20 −0 examples/tk.pl
View
@@ -0,0 +1,20 @@
+# vim: ft=perl6
+# (actually NQP; the real Perl6 version will be much neater)
+
+pir::load_bytecode('perl5.pbc');
+my $comp := pir::compreg__PS('perl5');
+
+my $mod := $comp.load_module('Tk');
+
+my %exp := $comp.get_exports($mod);
+
+my $mw := %exp<sub><&MainWindow>().new;
+
+$mw.Label(-text => 'Hello, world!').pack;
+
+$mw.Button(
+ -text => 'Quit',
+ -command => sub (*@_) { exit },
+).pack;
+
+

0 comments on commit d1f979c

Please sign in to comment.