I have a little logging app (written in wxPython) that receives data from a bit of kit we're developing, and I want to display the text in a scrolling window. As it stands I'm using a wx.TextCtrl for the text display, but I'm having some issues with the scrolling behaviour.
Basically, I'd like it so that if the scrollbar is at the bottom of the window (i.e. the end of the incoming data), adding more data should scroll the view onwards. If, however the view has been scrolled up a little (i.e. the user is looking at something interesting like an error message), the app should just add the text on the end without scrolling any more.
I've got two problems at the moment:
I've googled a bit and there seem to be a few hints that suggest GetScrollPos and GetScrollRange won't work for a wx.TextCtrl? Has anyone else had any experience in this area? Is there a nice easy way to solve the problem or am I going to have to roll my own wx.TextCtrl?
I just tested a simple example (checking GetScrollPos(0)
and GetScrollRange(0)
in EVT_TEXT
event handler for wx.TextCtrl
) and it works fine for me - they return index of currently shown line and total number of lines, respectively.
Maybe the problem is your wxPython version? I used:
>>> import wx
>>> wx.version()
'2.8.9.1 (msw-unicode)'