Re: Can't position Gnome2::Canvas within Gtk2::Frame





Well, first time for me using Gnome canvas. Easy apt-get on Ubuntu and your code works.

When you call show all on the top level window it goes through the widgets that have been added to it and does a few things for each widget. You can connect to a callback if you need to do or get something at a certain time.

I usually work with GTK3 and cairo is the drawing library that is used there. If you really get into drawing there is a lot that you can do in GTK3. You can draw with cairo or opengl. Also transparency works well so that adds to what you can do. There is a frame clock for animation. There is also CSS that you can set widget colors and properties with.

Eric

#!/usr/bin/perl
use strict;
use diagnostics;
use warnings;
use Gtk2 '-init';
use Glib qw(TRUE FALSE);
# Draw a Gtk2 window
my $window = Gtk2::Window->new();
$window->signal_connect('delete_event' => sub { Gtk2->main_quit; });
$window->set_default_size(200, 200);
$window->set_border_width(5);

my $button1 = Gtk2::Button->new_with_label("Button1");
$button1->signal_connect('size_allocate' => \&allocate_button);
$button1->signal_connect('realize' => \&realize_button);
$button1->signal_connect('map' => \&map_button);
$button1->signal_connect('clicked' => \&click_button);

$window->add($button1);

print "Show All\n";
$window->show_all();
Gtk2->main;

sub allocate_button
{
  print "Allocate\n";
}
sub realize_button
{
  print "Realize\n";
}
sub map_button
{
  print "Map\n";
}
sub click_button
{
  print "Click\n";
}




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]