By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,898 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,898 IT Pros & Developers. It's quick & easy.

ScrolledText?

P: n/a
nik
I've been trying to get the scrollbar and text box always going to the
last line and have been completely unsuccessful.

I've tried, ScrolledText, text.see, and text.yview_pickplace without
success

for instance this was the last setup:

self.text = ScrolledText(master, relief=RIDGE)
self.text.grid(column=1, row=2, columnspan=10,\
rowspan=5, pady=10, sticky=NSEW)

with this text entry:

self.text.insert(END, ins)
self.text.yview_pickplace("end")

Can anybody please tell me what I might be doing wrong, or an example
that works, so that I can see what's going wrong.

Thanks,
Nik

May 1 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Would this work?

self.text = wx.TextCtrl(panel, style=wx.TE_MULTILINE)
....
line = '\n' + "Hello world!"
self.text.AppendText(line)

May 1 '07 #2

P: n/a
nik
Thank you, but I am not sure.
What is wx in this case?

I should have mentioned that I am using Tkinter, am pretty new to
python
and had previously tried just a plain text box with a scrollbar
without success.
The scrollbar always works manually, nothing I've tried yet has
scrolled down automatically.

Thanks

May 1 '07 #3

P: n/a
Ah.. wx is wxPython in this case, a GUI toolkit like Tkinter, but
based on wxWidgets.
I don't know if Tk has a text control with a method similar to the
AppendText method I showed here.. I used to have the exact same
problem as you until I discovered that AppendText always kept the text
box scrolled at the bottom :)

How about this:
>>>help(Tkinter.Text.see)
Help on method see in module Tkinter:

see(self, index) unbound Tkinter.Text method
Scroll such that the character at INDEX is visible.

It may be what you're looking for if you use 'end' for index ...?

-Basilisk96

May 2 '07 #4

P: n/a
On May 1, 3:12 pm, nik <nikb...@gmail.comwrote:
I've been trying to get the scrollbar and text box always going to the
last line and have been completely unsuccessful.

I've tried, ScrolledText, text.see, and text.yview_pickplace without
success

for instance this was the last setup:

self.text = ScrolledText(master, relief=RIDGE)
self.text.grid(column=1, row=2, columnspan=10,\
rowspan=5, pady=10, sticky=NSEW)

with this text entry:

self.text.insert(END, ins)
self.text.yview_pickplace("end")

Can anybody please tell me what I might be doing wrong, or an example
that works, so that I can see what's going wrong.

Thanks,
Nik
try...

self.text.yview_moveto(1)

~Sean

May 2 '07 #5

P: n/a
nik
Great thank you for the help, we got it working.

May 2 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.