Skip to content

Instantly share code, notes, and snippets.

@tene
Created July 15, 2009 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tene/147853 to your computer and use it in GitHub Desktop.
Save tene/147853 to your computer and use it in GitHub Desktop.
use Elementary:from<parrot>;
elm_init(@*ARGV, $*PROGRAM_NAME);
my $win = Elementary::win::new(0, "Hello", 0);
$win.add_callback('delete-request', -> $data, $info { say 'Goodbye…'; elm_exit() }, "deleted");
my $bg = $win.'widget_add'('bg', 1.0, 1.0);
$win.'resize_object_add'($bg);
$bg.show();
my $box = $win.widget_add('box', 1.0, 1.0);
$win.resize_object_add($box);
$box.show();
my $fr = $win.widget_add('frame', 1.0, 1.0);
$fr.style('pad_large');
$box.pack_end($fr);
$fr.show();
my $lb = $win.widget_add('label', 1.0, 1.0);
$lb.label("Hello, World!");
$fr.content($lb);
$lb.show();
my $fr2 = $win.widget_add('frame', 1.0, 1.0);
$fr2.style('outdent_bottom');
$box.pack_end($fr2);
$fr2.show();
$fr = $win.widget_add('frame', 1.0, 1.0);
$fr.style('pad_medium');
$fr2.content($fr);
$fr.show;
my $box2 = $win.widget_add('box', 1.0, 1.0);
$box2.horizontal(1);
$box2.homogenous(1);
$fr.content($box2);
$box2.show;
my $bt = $win.widget_add('button', 1.0, 1.0);
$bt.label("YA RLY");
$box2.pack_end($bt);
$bt.show;
$bt.add_callback('clicked', -> $data, $info { say 'lol hai!' }, "hai");
$bt = $win.widget_add('button', 1.0, 1.0);
$bt.label("NO WAI");
$box2.pack_end($bt);
$bt.show;
$bt.add_callback('clicked', -> $data, $info { say ':( :( :(' }, "wtf");
$win.show();
elm_run();
elm_shutdown();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment