0
use Tk;

my $mw=new MainWindow;

$mw->geometry("1024x768");

$mw->Scrolled("Text", -scrollbars => "s", -width => 30,-height=>10)->pack( );

MainLoop;

I need the help.The horizontal scrollbar is not working. What am I doing wrong?

Stamm
  • 947
  • 5
  • 17
amit
  • 85
  • 8
  • What do you mean "not working". When I execute your script I'll get a window with a text box and a scrollbar at the bottom. – dgw Mar 21 '12 at 18:57
  • Yes i also get a scroll bar.But when i enter text with length more than width of text box,the scrollbar dose not appear.The text goes down another line. – amit Mar 22 '12 at 04:56

1 Answers1

3

What is the wrap mode of the text widget? If it's configured to wrap on word or character boundaries, the horizontal scrollbar won't ever be needed. For me, the default wrapping mode is char (i.e., wrap lines at character boundaries, like a terminal does) so I guess that's the default for you too, despite the fact that you're wanting it to be none (the only setting where a horizontal scrollbar is useful).

Add -wrap => "none", to your options to Scrolled.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
  • The `word` style of wrapping is more word-processor/web-browser like, working particularly well when using a variable-width font. – Donal Fellows Mar 27 '12 at 10:39