tkinter socket client ?

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Tue Jan 25 08:44:32 EST 2005


Tonino wrote:
> Hi,
> 
> thanks for this info - I had to abandon the createfilehandler() method
> as it is not supported in windows and the GUI "might" be used there at
> some time ...
> 
> So - I went the threading route - works well - for now - so I will
> stick to it ...
> 
> BUT - the next question:
> In the Text() widget - why - when the text scrolls off the screen -
> does the window not follow it ?
> 
> I have added a scrollbar to it :
> 
> self.center_frame = Frame(self.top_frame, background="tan",
> relief=RIDGE)
> 
> self.text=Text(self.center_frame,background='white')
> scroll=Scrollbar(self.center_frame)
> self.text.configure(yscrollcommand=scroll.set)
> 
> self.text.pack(side=LEFT, fill=BOTH, expand=YES)
> scroll.pack(side=RIGHT,fill=Y)
> self.center_frame.pack(side=RIGHT, expand=YES, fill=BOTH)
> 
> 
> but the window does not scroll to follow the text ?
> Any ideas ?
> 

This is the default behavior of the Text widget.  You have two options 
(as I see it) one, put the new text at the top of the Text widget 
textwidget.insert(0, "your new text") or two, use the yview_pickplace 
method to move the view down every time you insert text 
textwidget.yview_pickplace('end')

I wrote a sub-class of the ScrolledText widget to do just this
I gave it a write method - so I could re-direct stdout to it - and also 
called yview_pickplace in that method.

HTH
Martin.




More information about the Python-list mailing list