textctrl multiline errors on linux

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' toGtkTextView’

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

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
···

On Tuesday, May 22, 2012 11:06:23 AM UTC-5, blissend wrote:

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

Yep. You must specify this style when the textctrl is created, it can't be changed after.

···

On 5/22/12 9:15 AM, Mike Driscoll wrote:

On Tuesday, May 22, 2012 11:06:23 AM UTC-5, blissend wrote:

    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

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...

--
Robin Dunn
Software Craftsman

Ok fair enough. Does that also mean XRC cannot be be used with the multiline option? Attached an example that throws errors.

debug.py (511 Bytes)

debug.xrc (752 Bytes)

Sorry let me be a bit clearer. I have an xrc file that has something like this…

wxTE_MULTILINE

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

Yes, but XRC should be applying the style when it creates the widget. Is it not doing that?

···

On 5/22/12 12:37 PM, blissend wrote:

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
Software Craftsman