hi
i'm trying to learn perl gtk2 ,in the tutorials examples there is no description on how to position the widgets in a specific x,y coordinates. the example below from the tutorial have a button, text entry, label,
and as an example for demo purposes and in the main window which have the size (500,400) pixels how can i put the button on (x,y)=(30,50) pixels relative to the main window with size (30,20),
label on (x,y)=(200,50) size (100,50) text entry on (x,y) =(30,300)
best wishes for all
use Gtk2 '-init'; my $window = Gtk2::Window->new; $window->set_size_request(500,400); $window->set_position('center'); $window->set_title ("Hello world"); $window->signal_connect (destroy => sub { Gtk2->main_quit; }); my $vbox = Gtk2::VBox->new(); $vbox->set("border_width"=> 10); $window->add($vbox); my $label = Gtk2::Label->new("hello world"); $vbox->pack_start($label,0,0,5); # expand?, fill?, padding my $entry = Gtk2::Entry->new(); $vbox->pack_start($entry,0,0,5); my $button = Gtk2::Widget->new("Gtk2::Button", label=>"exit"); $button->signal_connect(clicked=>\&my_quit); $vbox->pack_start($button, 0,0,5); $window->show_all(); Gtk2->main; sub my_quit { print "bye!\n"; exit; }

In reply to gtk2 widgets positions by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.