Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
use v6;
use GTK::Simple;
my $app = GTK::Simple::App.new(title => 'Code Golf Assistant!');
$app.set_content(GTK::Simple::VBox.new(
my $source = GTK::Simple::TextView.new(),
my $chars = GTK::Simple::Label.new(text => 'Characters: 0'),
my $elapsed = GTK::Simple::Label.new(),
my $results = GTK::Simple::TextView.new(),
));
$source.changed.tap({
$chars.text = "Characters: $source.text.chars()";
});
Supply.interval(1).schedule-on(
GTK::Simple::Scheduler
).tap(-> $secs {
$elapsed.text = "Elapsed: $secs seconds";
});
$source.changed.stable(1).start({
use MONKEY-SEE-NO-EVAL;
(try EVAL .text) // $!.message
}).migrate.schedule-on(GTK::Simple::Scheduler).tap(
{ $results.text = $_ }
);
$app.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.