use strict; use XML::Twig; use Tkx; use Net::FTP; use Thread; $Tkx::TRACE=64; my $file_count=200; my $progress =100; # needed for frames and grids to work. Tkx::package_require("tile"); # main window and properties my $main_window = Tkx::widget->new("."); my $grid = $main_window->new_ttk__frame( # left going clockwise -padding => "1 1 1 1", -borderwidth => 5, ); $grid->g_grid( -column => 0, -row => 0, -sticky => "nsew", ); $main_window->g_grid_columnconfigure( 0, -weight => 1, ); $main_window->g_grid_rowconfigure( 0, -weight => 1, ); &init(); Tkx::MainLoop(); sub init { # Progress bar... #my $progress = 0; my $overall_progress_bar = $grid->new_ttk__progressbar( -orient => "horizontal", -mode => "determinate", -length => "200", -maximum => 400, -value => $progress, ); # buttons... my $publish = $grid->new_button( -text => "Publish", -command => sub { # now for heavy lifting... # get a list of files to be FTPed. print $progress; $progress=$progress+100; Tkx::i::DoOneEvent(0); # allow gui to update #print $progress; #Tkx::update(); }, ); # layout section $overall_progress_bar->g_grid(-column => 0, -row => 5, -columnspan => 4); &layout($grid); } sub layout { # Grabs a list of the current elements on the grid and adds 2px padding # on every side of each element. foreach (Tkx::SplitList($_[0]->g_winfo_children)) { Tkx::grid_configure($_, -padx => 2, -pady => 2); } }