limitation of the text pasted from the clipboard in wx.TextCtrl?
Vlastimil Brom
vlastimil.brom at gmail.com
Mon Feb 4 06:03:34 PST 2008
Hi all,
I'd like to ask about the behavior of the wx.TextCtrl
widget while inserting text from the clipboard.
It seems, that there are some limits on the size of the input text, but I
couldn't find any details.
If I try to insert some larger text from clipboard, sometimes only a part of
it gets pasted; however, if I clear the pasted characters and try to insert
the same clipboard content, on the second trial approx. twice as large chunk
is pasted. After come repeats tho whole content can be
successfully entered (however, for larger clipboard the application crashes
before that).
(I use Python 2.5.1 and wxPython 2.8.7.1 on Win XPh/XPp SP2)
The respective multiline text control is created using
wx.TextCtrl(frm, -1, style=3Dwx.TE_MULTILINE | wx.TE_RICH2)
(without wx.TE_RICH2 the behaviour is the same)
It appears on a very basic app using this widget, like:
#######################
#! Python
# -*- coding: utf-8 -*-
import wx
appl =3D wx.PySimpleApp()
frm =3D wx.Frame(None, -1, "test wx.TextCtrl")
testTxtCtrl =3D wx.TextCtrl(frm, -1, style=3Dwx.TE_MULTILINE | wx.TE_RICH2)=
#
sizerFrm =3D wx.BoxSizer(wx.HORIZONTAL)
sizerFrm.Add(testTxtCtrl, 1, wx.EXPAND)
frm.SetSizer(sizerFrm)
frm.Show(1)
appl.MainLoop()
#######################
E.g. the following test data can be used:
for i in xrange(1000): print str(i).zfill(99)
i.e. 1000 100-character lines.
If I copy the resulting text to the clipboard and paste it repeatedly to the
TextCtrl widget, it gets inserted in the following chunks (shortcut Ctrl+V
as well as context menu act the same):
326
657
991
999
(zero-based line numbers of the last completely inserted line)
After the complete text (lines 0-999) is once inserted, the next tries are
always ok.
Is there some known limitation here, or is there something I can use to
overcome it? (currently I am using stc for larger inputs or loading form
file).
The other way, i.e. copying from the widget to some editor works fine.
Many thanks in advance,
vbr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200802=
04/0ded479b/attachment.htm
More information about the wxpython-users
mailing list