Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Ok. Here is some sample code.
#!/usr/bin/perl -w use strict; use Gtk2 '-init'; use Glib qw/TRUE FALSE/; #shared variables my $active_interface: shared; #create dummy main window my $main_window = Gtk2::Window->new('toplevel'); $main_window->signal_connect(delete_event=> sub{Gtk2->main_quit}); my $label = Gtk2::Label->new('TEST '); my $main_table = Gtk2::Table->new(2, 1, FALSE); $main_table->attach_defaults($label, 0, 1, 0, 1); $main_window->add($main_table); $main_window->show_all; &start_up; Gtk2->main; #The start up askng the user what position they are in sub start_up{ #the User interface select window my $start_up = Gtk2::Window->new('toplevel'); #create table my $job_table = Gtk2::Table->new(3, 1, FALSE); #label my $job_label = Gtk2::Label->new(" Select User Interface +"); #Combobox to select user my $job_select = Gtk2::ComboBox->new_text; $job_select->append_text('Spotter'); $job_select->append_text('Tracker'); $job_select->append_text('VC Base'); $job_select->append_text('Met Base'); $job_select->set_active(0); #add the Ok button my $job_button = Gtk2::Button->new('Start'); #add to table $job_table->attach_defaults( $job_label, 0, 1, 0, 1); $job_table->attach_defaults( $job_select, 0, 1, 1, 2); $job_table->attach_defaults( $job_button, 0, 1, 2, 3); #add widgets $start_up->add($job_table); $start_up->show_all; #capture the interface type to use and display in the main window $job_button->signal_connect('button-press-event' => sub { $active_in +terface = $job_select->get_active_text; my $active_interface_label = +Gtk2::Label($active_interface); $main_table->attach_defaults($active_ +interface_label, 0, 1, 1, 2); $start_up->destroy}); }
and upon running I receive these errors: Use of inherited AUTOLOAD for non-method Gtk2::Label() is deprecated at GRRUVI-v 1.20.pl line 60. *** unhandled exception in callback: *** Can't locate auto/Gtk2/Label.al in @INC (@INC contains: C:/Perl/site/lib C :/Perl/lib .) at GRRUVI-v1.20.pl line 60 *** ignoring at GRRUVI-v1.20.pl line 25. So I guess the question is how do I get this to work? Ant ideas?

In reply to Re^2: A dynamic Main Window in GTK2 by deadpickle
in thread A dynamic Main Window in GTK2 by deadpickle

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
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? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2021-11-30 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?