-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to use Cairo in DrawingArea #69
Comments
The |
That may fix that problem but there may be another issue |
dwarring
added a commit
to dwarring/gtk-simple
that referenced
this issue
Jun 19, 2017
To get the following to work (display aqua square) use v6.c; use GTK::Simple; use GTK::Simple::DrawingArea; my $app = GTK::Simple::App.new(:title<Test>); my $da = GTK::Simple::DrawingArea.new; gtk_simple_use_cairo; $app.set-content( $da ); $app.border-width = 20; $da.size-request(300,300); sub rect-do( $d, $ctx ) { given $ctx { .rgb(0, 0.7, 0.9); .rectangle(10, 10, 50, 50); .fill :preserve; .rgb(1, 1, 1); .stroke }; } my $ctx = $da.add-draw-handler( &rect-do ); $app.run;
dwarring
added a commit
that referenced
this issue
Jun 19, 2017
fix gtk_simple_use_cairo() as per issue #69
@finanalyst
|
I've also added this as examples/18-cairo-draw-handler.pl6 e42501e |
Please reopen, if there's any further problems. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Cairo documentation is sparse and there is no example for the use of DrawingArea.
Also the following error is puzzling:
$perl6 test_lib.p6
Could not find symbol '&ConnectionHandler'
in method add-draw-handler at /home/richard/perl6/rakudo-star-2016.07/install/share/perl6/site/sources/A6D434FC7BEE2A422FB2B8F6CF413E78905D1848 (GTK::Simple::DrawingArea) line 33
in block at test_lib.p6 line 20
Actually thrown at:
in method add-draw-handler at /home/richard/perl6/rakudo-star-2016.07/install/share/perl6/site/sources/A6D434FC7BEE2A422FB2B8F6CF413E78905D1848 (GTK::Simple::DrawingArea) line 33
in block at test_lib.p6 line 20
$ cat test_lib.p6
#!/usr/bin/env perl6
use v6.c;
use GTK::Simple;
use Cairo;
use GTK::Simple::DrawingArea;
my $app = GTK::Simple::App.new(:title);
my $da = GTK::Simple::DrawingArea.new;
gtk_simple_use_cairo;
$app.set-content( $da );
$app.border-width = 20;
$da.size-request(300,300);
my $ctx = $da.add-draw-handler( &rect-do );
$app.run;
sub rect-do( $d, $ctx ) {
given $ctx {
.rgb(0, 0.7, 0.9);
.rectangle(10, 10, 50, 50);
.fill :preserve; .rgb(1, 1, 1);
.stroke
};
}
The text was updated successfully, but these errors were encountered: