Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

even though Gtk3 module is still in development . Most the code is working in Gtk3.


i have experienced some issues when the window is resized .. buttons are expanding with it .. and help me with accelerators .... please

use strict; use warnings; use Gtk3 '-init'; use Glib qw/TRUE FALSE/; #Creating Window my $window = Gtk3::Window->new('toplevel'); $window->set( title=>rand(int(100)), # default_height=>'300', # default_width=>'300', resizable=>'TRUE', focus_on_map=>'TRUE' ); #creating a Vbox my $vbox = Gtk3::Box->new('vertical',3); $vbox->set( visible=>TRUE, can_focus=>FALSE, double_buffered=>FALSE, homogeneous=>TRUE, expand=>'false' ); #creating button my $button = &button; my $menubar = &createmenubar; my $text_view = Gtk3::TextView->new(); $text_view->set(editable=>FALSE,cursor_visible=>FALSE); my $scroll = Gtk3::ScrolledWindow->new(); $scroll->add($text_view); # Vbox # |--->Menubar # |--->Button # |--->TextView #adding itesm to Vbox $vbox->pack_start($menubar,FALSE,TRUE,3); $vbox->pack_start($scroll,TRUE,TRUE,0); $vbox->pack_start($button,FALSE,FALSE,0); # Window # |--->Vbox $window->add($vbox); #adding accelerator group my $accel_group = Gtk3::AccelGroup->new(); $window->add_accel_group($accel_group); #signale to destroy the main Gtk $window->signal_connect(destroy=>\&quit); $window->show_all; Gtk3->main; sub changetitle{ print $window->get_title(),"\n"; $window->set( title=>rand(int(100)), ); } sub createmenubar{ my $menu_item_file = Gtk3::MenuItem->new_with_label('File'); my $menu_bar = Gtk3::MenuBar->new(); $menu_bar->add($menu_item_file); my $menu_file = Gtk3::Menu->new(); my $menu_item_refresh = Gtk3::ImageMenuItem->new_from_stock('gtk-r +efresh'); $menu_file->add($menu_item_refresh); $menu_item_refresh->signal_connect(activate=>\&changetitle); my $menu_item_quit = Gtk3::ImageMenuItem->new_from_stock('gtk-quit +'); $menu_item_quit->signal_connect(activate=>\&quit); # $menu_item_quit->add_accelerator('activate',$accel_group,Gtk3::Ac +celerator->parse('<Control>Q'),'visible'); $menu_file->add($menu_item_quit); $menu_item_file->set_submenu($menu_file); return $menu_bar; } sub button { my $button_sub =Gtk3::Button->new_with_label('Click to Change the +Title'); #connecting signale connnect clicked to subroutine $button_sub->signal_connect(clicked=>\&changetitle); $button_sub->set( use_action_appearance=>FALSE, visible=>TRUE, can_focus=>TRUE, receives_default=>TRUE, use_action_appearance=>FALSE ); return $button_sub; } sub quit { Gtk3->main_quit; }
Sorry Mistake ... i have got figured the thing
#creating a Vbox my $vbox = Gtk3::Box->new('vertical',3); $vbox->set( visible=>TRUE, can_focus=>FALSE, double_buffered=>FALSE, expand=>'false' );

In reply to Gtk3 expand problem with box by Kanishka.black0

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others examining the Monastery: (5)
    As of 2024-09-14 20:26 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      The PerlMonks site front end has:





      Results (21 votes). Check out past polls.

      Notices?
      erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.