ScrolledText?

N

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
 
B

Basilisk96

Would this work?

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

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
 
B

Basilisk96

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 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
 
H

half.italian

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top