in reply to Re: [Tkx] Scrolled frame problem
in thread [Tkx] Scrolled frame problem

I'm not sure. It's the first time I create a GUI. Anyway, my frame ($logfrm) has a fixed dimension and a border. The content of the label ($loglbl) increases when the program runs. The label grows too much, but I want to keep the frame's initial dimensions. So I would like to be able to "navigate" the content of the $loglbl.

I suppose I should scroll the label($loglbl)?

P.S.: Thanks for your comment. It's true; I took a look to the "Monastry HTML". And I apologize for my english level...I sudied it only a couple of years, but I find it much harder then the Perl language! :D

Replies are listed 'Best First'.
Re^3: [Tkx] Scrolled frame problem
by keszler (Priest) on Feb 16, 2010 at 21:50 UTC
    Think of it like this:
    • the frame has fixed dimension
    • the label content is more than can been seen in the fixed frame
    • therefore the label is bigger than the frame
    • therefore the frame needs to scroll to show all the label

      I changed it this way :

      my $pageValidation = $fenetre3->new_ttk__frame(-padding => "20 30 5 5" +); $pageValidation->g_grid(-column => 0, -row => 0, -sticky => "news"); $pageValidation->configure(-height => 300, -width => 300); my $logcontent; my $logfrm = $pageValidation->new_ttk__frame(-padding => "5 5 5 5"); $logfrm->g_grid(-column => 1, -row => 1, -sticky => "news"); $logfrm->configure(-borderwidth => 2, -relief => "sunken", -height => +300, -width => 605); $logfrm->g_grid_propagate(0); my $loglbl = $logfrm->new_ttk__label(-textvariable => \$logcontent, -w +raplength=>590); $loglbl->g_grid( -column => 0, -row => 0, -sticky => "new",-padx=>0, - +pady=>0, ); $loglbl->configure(-width=>98,); my $s = $pageValidation->new_ttk__scrollbar(-orient => 'vertical', -co +mmand => [$logfrm, 'yview']); $logfrm->configure(-yscrollcommand => [$s, 'set']); my $boutConfirmation = $pageValidation->new_ttk__button( -text => "La +ncer Conversion", -command => sub {lancerApplication(\$logcontent,\%g +eneraloptions)}); $boutConfirmation->g_grid( -column => 1, -row => 3, -sticky => "sw", - +pady => 7); sub lancerApplication{ my %generaloptions = %{$_[1]}; my $optionsfile='generalOptions.txt'; my $paramsfile='parametersForTEICorpus.txt'; my $refgeneraloptions= \%generaloptions; if ($generaloptions{'externaloptions'}){ $optionsfile=$generaloptions{'filename'}; } else{ ecrireoptgen ($_[1]); } &ma_fonction::main($optionsfile,$paramsfile,\$_[0]); }

      I have got no more the precedent error. The program opens correctly, but I still can't see the scrollbar.

      Any suggestion? BTW, thanks for your answers!

        I believe someone said earlier that the Label widget doesn't take a scrollbar. Personally, I'd use a Text (set to read-only) instead of a label.

        Alternately, check out the Pane widget - here's a discussion, albeit using Perl/Tk, rather than Tkx.

        for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";