use strict; #use XML::Twig; use Tkx; use Net::FTP; use Thread; $Tkx::TRACE=64; ############################ $|=1; ############################ 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, ############################ -variable => \$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; ############################ # either of these seems to work Tkx::i::DoOneEvent(0); # allow gui to update #Tkx::update('idletasks'); ############################ #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 pa +dding # on every side of each element. foreach (Tkx::SplitList($_[0]->g_winfo_children)) { Tkx::grid_configure($_, -padx => 2, -pady => 2); } }
for the printing $|=1; At first i thought it was Tkx::update('idletasks'); rather than Tkx::i::DoOneEvent(0); but in the end it was -variable => rather than -value


In reply to Re^2: Can't get progress bar or main window to update using Tkx by huck
in thread Can't get progress bar or main window to update using Tkx 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.