wx.GridSizer and Insert method

Anybody can pass a working example of using Insert to set a widget at the desired row and column of a wx.GridSizer? Many thanks in advance.

raffaello wrote:

Anybody can pass a working example of using Insert to set a widget at the desired row and column of a wx.GridSizer? Many thanks in advance.

It's not row/column based, but rather an index into the list of items being managed by the sizer.

$ pydoc wx.Sizer.Insert
Help on method Insert in wx.Sizer:

wx.Sizer.Insert = Insert(*args, **kwargs) unbound wx._core.Sizer method
     Insert(self, int before, item, int proportion=0, int flag=0, int border=0,
         PyObject userData=None) -> wx.SizerItem

     Inserts a new item into the list of items managed by this sizer before
     the item at index *before*. See `Add` for a description of the parameters.

···

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

Now I suppose there is a bug, unless I have misunderstood something in pydoc: if I try to INSERT an objext in the wx.FlexGridSizer I get an AssertionError (wx._core.PyAssertionError: C++ assertion “wxAssertFailure” failed at …..\src\common\list.cpp(321) in wxListBase::Item(): invalid index in wxListBase::Item).

See attached code. The result is the same even if I change the index value.

trial_grafici.py (4.99 KB)

···

2008/8/14 Robin Dunn robin@alldunn.com

raffaello wrote:

Anybody can pass a working example of using Insert to set a widget at the desired row and column of a wx.GridSizer? Many thanks in advance.

It’s not row/column based, but rather an index into the list of items being managed by the sizer.

$ pydoc wx.Sizer.Insert

Help on method Insert in wx.Sizer:

wx.Sizer.Insert = Insert(*args, **kwargs) unbound wx._core.Sizer method

Insert(self, int before, item, int proportion=0, int flag=0, int border=0,

    PyObject userData=None) -> wx.SizerItem



Inserts a new item into the list of items managed by this sizer before

the item at index *before*.  See `Add` for a description of the parameters.

Robin Dunn

Software Craftsman

http://wxPython.org Java give you jitters? Relax with wxPython!


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

raffaello wrote:

Now I suppose there is a bug, unless I have misunderstood something in pydoc: if I try to INSERT an objext in the wx.FlexGridSizer I get an AssertionError (wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at ..\..\src\common\list.cpp(321) in wxListBase::Item(): invalid index in wxListBase::Item).
See attached code. The result is the same even if I change the index value.

What did you try changing it to? The index is zero based, so the first position is zero.

···

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

Blame the heat wave. Now Insert runs fine, and I cannot event reconstruct what I was doing wrong. I feel ashamed :frowning:
But many thanks for your patience.

···

2008/8/16 Robin Dunn robin@alldunn.com

raffaello wrote:

Now I suppose there is a bug, unless I have misunderstood something in pydoc: if I try to INSERT an objext in the wx.FlexGridSizer I get an AssertionError (wx._core.PyAssertionError: C++ assertion “wxAssertFailure” failed at …..\src\common\list.cpp(321) in wxListBase::Item(): invalid index in wxListBase::Item).

See attached code. The result is the same even if I change the index value.

What did you try changing it to? The index is zero based, so the first position is zero.

Robin Dunn

Software Craftsman

http://wxPython.org Java give you jitters? Relax with wxPython!


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users