textctrl multiline errors on linux

220 views
Skip to first unread message

blissend

unread,
May 22, 2012, 12:06:23 PM5/22/12
to wxpytho...@googlegroups.com
Hi,

I'm using Fedora 16 with wxPython 2.9.3.1 and I'm having problems setting a textctrl to be multiline. It works fine on both Windows 7 and Fedora 16 if I do this...

text = wx.TextCtrl(frame, -1, 'test', size=(200,200), style=wx.TE_MULTILINE)

However, if I do it this way it only works on Windows 7 but throws errors/warnings on Fedora 16...

text = wx.TextCtrl(frame, -1, 'test', size=(200,200))
text.SetWindowStyle(wx.TE_MULTILINE)

This is the warning I get on Linux...
(debug.py:2094): GLib-GObject-WARNING **: invalid cast from `GtkEntry' to `GtkTextView'

I first noticed this using XRC to define a textctrl to be multiline but it threw a different message on Linux...
wx._core.PyAssertionError: C++ assertion "IsSingleLine()" failed at /tools/wxPython-src-2.9.3.1/src/gtk/textctrl.cpp(828) in GetEditable(): shouldn't be called for multiline

Am I doing something wrong here?

Thanks,
Adam

Mike Driscoll

unread,
May 22, 2012, 12:15:33 PM5/22/12
to wxpytho...@googlegroups.com

I'm guessing there are two different widgets on Linux whereas on Windows, it's just one. Thus you probably have to instantiate it one way or the other, not change it after it's been created. We'll see if my hunch is right when Robin jumps in here...

- Mike

Robin Dunn

unread,
May 22, 2012, 1:37:12 PM5/22/12
to wxpytho...@googlegroups.com
Yep. You must specify this style when the textctrl is created, it can't
be changed after.


--
Robin Dunn
Software Craftsman
http://wxPython.org

blissend

unread,
May 22, 2012, 3:28:35 PM5/22/12
to wxpytho...@googlegroups.com
Ok fair enough. Does that also mean XRC cannot be be used with the multiline option? Attached an example that throws errors.
debug.py
debug.xrc

blissend

unread,
May 22, 2012, 3:37:05 PM5/22/12
to wxpytho...@googlegroups.com
Sorry let me be a bit clearer. I have an xrc file that has something like this...

<object class="wxTextCtrl" name="text">
    <style>wxTE_MULTILINE</style>

Which I believe is the only way to specify multiline in a file like that right?

Robin Dunn

unread,
May 24, 2012, 2:14:36 PM5/24/12
to wxpytho...@googlegroups.com
Yes, but XRC should be applying the style when it creates the widget.
Is it not doing that?
Reply all
Reply to author
Forward
0 new messages