python - wxpython use the same static text twice in FlexGridSizer.AddMany -


i duplicate column headings in first python gui. have tried following

    bfont = wx.font(10,wx.default,wx.normal,wx.bold)     angle = wx.statictext(panel,label="angle")     angle.setfont(bfont)     count_c = wx.statictext(panel,label="counts (c)")     count_c.setfont(bfont)     count_u = wx.statictext(panel,label="counts (u)")     count_u.setfont(bfont)      fgs.addmany([(angle),(count_c), (count_u),                  (angle),(count_c), (count_u)])       vbox.add(fgs, proportion=1,flag=wx.all|wx.expand,border=5) 

however shows me second set of headers. how can done?

you cannot add same widget 2 different locations. instead, you'll have create separate widgets each row. since want same thing on each row, can use loop:

import wx  ######################################################################## class mypanel(wx.panel):     """"""      #----------------------------------------------------------------------     def __init__(self, parent):         """constructor"""         wx.panel.__init__(self, parent)         bfont = wx.font(10,wx.default,wx.normal,wx.bold)          vbox = wx.boxsizer(wx.vertical)         fgs = wx.flexgridsizer(rows=2, cols=3, vgap=5, hgap=5)          # add 2 rows of widgets sizer         widgets = []         in range(2):             angle = wx.statictext(self,label="angle")             angle.setfont(bfont)             widgets.append(angle)              count_c = wx.statictext(self,label="counts (c)")             count_c.setfont(bfont)             widgets.append(count_c)              count_u = wx.statictext(self,label="counts (u)")             count_u.setfont(bfont)             widgets.append(count_u)          fgs.addmany(widgets)         vbox.add(fgs, proportion=1,flag=wx.all|wx.expand,border=5)         self.setsizer(vbox)  ######################################################################## class myframe(wx.frame):     """"""      #----------------------------------------------------------------------     def __init__(self):         """constructor"""         wx.frame.__init__(self, none, title="test")         panel = mypanel(self)         self.show()  if __name__ == "__main__":     app = wx.app(false)     frame = myframe()     app.mainloop() 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -