Alec Bennett wrote:
If I make the TxtCtrl read only and don't set the insertion point, I only see the very beginning of the text control, while it grows larger off screen. In other words I'd have to manually scroll to the end to read the most recent data.
What I want to happen is for the new data to be appended to the end of the text control, and for me to see that new data.
\
I don't know what you're doing, but the following demo I created works fine for me:
<code>
import time
import sys
import wx
class RedirectText(object):
def __init__(self,aWxTextCtrl):
self.out=aWxTextCtrl
def write(self,string):
self.out.WriteText(string)
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, title="Test Frame")
panel = wx.Panel(self, wx.ID_ANY)
log = wx.TextCtrl(panel, wx.ID_ANY, "",
size=(300,100),
style=wx.TE_MULTILINE)
log.Disable()
# redirect text
redir=RedirectText(log)
sys.stdout=redir
# make a timer here
timeLapse = 1000
self.timer = wx.Timer(self)
self.timer.Start(timeLapse)
self.Bind(wx.EVT_TIMER, self.updateStatus, self.timer)
self.Show()
def updateStatus(self, event):
"""
Update the status log
"""
print "Status update: %s\n" % time.ctime()
if __name__ == "__main__":
app = wx.PySimpleApp()
frame = MyFrame()
app.MainLoop()
</code>
I'm on Windows XP, wxPython 2.8.9.1, Python 2.5. Maybe that's not what you want though?
ยทยทยท
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org
__________ Information from ESET NOD32 Antivirus, version of virus signature database 3988 (20090404) __________
The message was checked by ESET NOD32 Antivirus.