user interface - wxWidgets in Python -- SetContainingSizer(): Adding a window to the same sizer twice? -
i'm brand new wxwidgets. i'm tyring use elses routines provide gui data analysis tool. haven't been able contact author... i'm getting error on line 106:
pyassertionerror: c++ assertion "!sizer || m_containingsizer != sizer" failed @ /build/wxpython-src-2.9.2.4/src/common/wincmn.cpp(2275) in setcontainingsizer(): adding window same sizer twice?
the offending code looks this:
coord_panel = wx.panel(pane, wid.any) grid_sizer = wx.flexgridsizer(3,4) coord_panel.setsizer(grid_sizer) rc_x_label = wx.statictext(coord_panel, wid.any, "x :") rc_y_label = wx.statictext(coord_panel, wid.any, "y :") rc_z_label = wx.statictext(coord_panel, wid.any, "z :") self.rc_x = wx.textctrl(coord_panel, wid.any, style=wx.te_readonly, size=(75,-1)) self.rc_y = wx.textctrl(coord_panel, wid.any, style=wx.te_readonly, size=(75,-1)) self.rc_z = wx.textctrl(coord_panel, wid.any, style=wx.te_readonly, size=(75,-1)) empty_label = wx.statictext(coord_panel, wid.any, " ") self.edit_cam_btn = wx.button(coord_panel, -1, "edit", size=(50,-1)) grid_sizer.addmany([(rc_x_label, 0, wx.align_center_vertical | wx.align_right), (self.rc_x, 0), (empty_label, 0), (empty_label, 0),\ (rc_y_label, 0, wx.align_center_vertical | wx.align_right), \ (self.rc_y, 0), (empty_label, 0), (self.edit_cam_btn, 0),\ (rc_z_label, 0, wx.align_center_vertical | wx.align_right), \ (self.rc_z, 0), (empty_label, 0)])
it's generating error on grid_sizer.addmany
line. see issue?
thx!
the code incorrect, can't add same empty_label
control multiple times sizer. need create new control (which luckily not difficult empty label) every time.
a better idea avoid using empty labels , use spacers or intra-row gap instead require more changes code.
Comments
Post a Comment