[wxPython-users] wx.TextCtrl maximal line length

Robin Dunn robin at alldunn.com
Sat Aug 12 11:41:23 PDT 2006


stefaan wrote:
> Hello list,
> 
> I seem to have hit a limit in the wx.TextCtrl, created with
> wx.TE_MULTILINE and wx.HSCROLL, when displaying a long line of text.
> (long in my case meaning > 12000 characters)
> The output is corrupted, as if two lines of text were printed on top of each
> other. The control works perfectly for short lines of text.
> 
> In fact I want to display two such lines, neatly aligned under each other, 
> and with differences between them being colored.
> 
> Is this a python specific limitation, or a general wxwidgets limitation?

I expect that it is a limitation of the gtk widget being used for the 
textctrl.  It may be that some internal value dealing with the 
horizontal pixel position is overflowing and so it is wrapping around to 
a smaller value for the subsequent characters.

> Any other widgets I could use to accomplish my goal?

If you don't need to edit the text then I'd suggest using a 
ScrolledWindow and drawing the text segments yourself, although the 
ScrolledWindow might have the same problem if the virtual size gets too 
big.  (Some platforms have limits on how big of a coordinate space can 
be for DC's or windows.  In that case I would use an unscrolled window 
with an added scrollbar and then virtualize the drawing of the visible 
space of the lines yourself based on the position of the scrollbar.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list