June 25th, 2004, 07:42 AM
problems scrolling in text areas
I am having problems using the scrollbar in a text box. When I create the scrollbar the text area shrinks in size, and even when I try to resize the text area, it remains the same. Here is the code!
scrollText1 = Scrollbar(self.text1)
scrollText1.config(command = self.text1.yview)
self.text1.config(yscrollcommand = scrollText1.set, height = 15, width = 85)
scrollText1.pack(side = RIGHT, fill = Y)
self.text1.grid(column = 1, row = 2, sticky = N+E+S+W)
self.text1 is previously declared. Any suggestions would be very appreciative
June 25th, 2004, 09:09 AM
Personally I use the scrolled text widget:
from ScrolledText import ScrolledText
self.text = ScrolledText(self.parent)
When you say shrinks in size - what exactly happens?
June 25th, 2004, 03:50 PM
without the scrollbar the text area is 15 lines,
when i declare a scrollbar to accompany the text area, it shrinks to 6 lines, even when the text area is declared to be larger. This happens no matter where the configuration for the text area is stated.
Thanks for the help though, I will probably change my code to use your suggestion if I can't figure it out soon.
June 26th, 2004, 07:43 PM
The scrollbar needs a container as a parent (Frame,Window), a text box is not enough it seems. If you set the scrollbars parent to be the containing frame the text box should size correctly.