Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use Tk; my ($mainwindow, $menubar, $display, $text); my $counter = 0; $mainwindow = new MainWindow; $mainwindow->geometry("800x400"); $display = $mainwindow->Scrolled('Text', -relief=>'sunken', -borderwidth=>'2', -height=>'24', -scrollbars=>'se', '-width' => 40, '-wrap'=>'none'); $display->pack(-expand=>'1', -fill=>'both'); $text = $display->Subwidget('text'); # need this because yo +u can't tie to $display - main widget tie *STDOUT, ref $text, $text; create_gui_main(); $text->repeat( 1000, sub { goto \&mymain; }, ); MainLoop; sub mymain() { # This would normally be real text $counter++; print "this is a very long line we need a scrollbar on the x axis........ this is a very long line we need a scrollbar on the x axis........ this is a very long line we need a scrollbar on the x axis........ well the number is current = " . $counter . " \n"; } # ------------------------ # sub quitapp() { exit; } # ------------------------ # sub create_gui_main { my $menuitems = [ [Cascade => "~File", -menuitems => [ [Button => "~Quit", -command => \&quitapp], ] ], ]; if ($Tk::VERSION >= 800) { $menubar = $mainwindow->Menu(-menuitems => $menuitems); $mainwindow->configure(-menu => $menubar); } else { $mainwindow->Menubutton(-text => "Pseudo menubar", -menuitems => $menuitems)->pack; } } __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk and scrollbars
by eserte (Deacon) on Jul 09, 2004 at 09:22 UTC | |
by jammin2night (Initiate) on Jul 09, 2004 at 12:27 UTC | |
|
Re: Tk and scrollbars
by SciDude (Friar) on Jul 09, 2004 at 03:56 UTC |