CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Gtk object sizing

 



frist44
User

Jan 10, 2009, 6:10 PM

Post #1 of 1 (872 views)
Gtk object sizing Can't Post

I have a GUI script through Gtk and I'm having trouble understanding why there is so much added space. attached is the screenshot. code is below:


Code
#!/usr/bin/perl -w 
#


use strict;
use Glib ':constants';
use Gtk2 -init;

my $window = Gtk2::Window->new;
$window->set_title("Website Monitor");
#$window->set_size_request(800,200);
$window->set_resizable(FALSE);
#$window->set_default_size(300,200);

$window->signal_connect (destroy => sub {Gtk2->main_quit});

# Set main Vbox for Window

my $main_vbox = Gtk2::VBox->new("false", 0);
$window->add($main_vbox);

my $label = Gtk2::Label->new(GetStatus());
$main_vbox->pack_start($label, TRUE, TRUE, 10);
#$main_vbox->add($label);

# Set Horizontal button box

my $hbox_button = Gtk2::HButtonBox->new;
$hbox_button->set_layout('end');
$hbox_button->set_spacing(10);
$main_vbox->add($hbox_button);

# .. And a refresh button
my $refresh_button = Gtk2::Button->new ("_Refresh");
$refresh_button->signal_connect(clicked => sub {
$label->set_text(GetStatus());
});
$hbox_button->add($refresh_button);

# .. And a Quit button
my $quit_button = Gtk2::Button->new_from_stock("gtk-quit");
$quit_button->signal_connect(clicked => sub {Gtk2->main_quit;});
$hbox_button->add($quit_button);

# Subroutine to get the status of websites

sub GetStatus {

my @read;
my $result;

open(OUTPUT, "netstat -at |");
@read = <OUTPUT>;
close(OUTPUT);

$result = join("",@read);

return $result;

}

$window->show_all;
Gtk2->main;
Attachments: Screenshot.png (155 KB)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives