Re: How to increase buffer for text widget



On Jul 29, 4:52 pm, lawsonre...@xxxxxxxxx wrote:
When loading text into my text widget, the GUI only displays 9 lines
of text. I believe I need to increase the buffer size for the text
widget.

How would I do this?

Thanks.

The buffer is already larger than 9 lines. You can do one of two
things or both. Pack the text widget so that it expands ( but you will
be limited to the number of rows that will fit on your screen) or you
will need to add scrollbars to get to view the remainder of the data.

An example cut from some code. This creates a text widget 80 columns
wide ( by default lines are wrapped) and 30 lines high but
the packing options are such that you can resize to any size and the
text widget will adjust.

package require Tk

proc makeExample { {root . } } {
set root [string trimright .$root "." ]
frame $root.topframe -relief groove
set t [text $root.topframe.text -width 80 -height 30 -
yscrollcommand { $root.topframe.sy set} ]
scrollbar $root.topframe.sy -command [list $t yview]
pack $t -side left -expand 1 -fill both
pack $root.topframe.sy -side left -expand 0 -fill y
pack $root.topframe -side top -expand 1 -fill both
return $t
}
set txtwidget [makeExample . ]
for { set i 0 } { $i < 100 } { incr i } {
$txtwidget insert end [string repeat $i 30 ]\n
}


HTH

Carl
.



Relevant Pages

  • Re: Kosolenfenster in C/C++ Anwendung
    ... Die Funktion die dann den Consolenoutput in das Widget schreibt sieht ... GtkTextBuffer *buffer; ... GtkTextIter iter; ...
    (de.comp.os.unix.programming)
  • How to increase buffer for text widget
    ... When loading text into my text widget, the GUI only displays 9 lines ... I believe I need to increase the buffer size for the text ...
    (comp.lang.tcl)
  • Re: [opensuse] missing in kde4?
    ... the classic KMenu. ... can even adjust the size of the widget up to cover the whole screen. ... I'm using the Oxygen desktop theme, and you can't even tell the folder ...
    (SuSE)
  • Background/foreground on disabled Tkinter.Entry
    ... If I create a Tkinter.Entry widget, I can adjust the background and the ... using the background and foreground options. ... grey on a light grey background. ...
    (comp.lang.python)
  • Counting text pixels
    ... I want to adjust the size of text widget so that all the text is vertically ... and no extra space. ... available or the text widget couldn't scroll. ...
    (comp.lang.tcl)