class - wxFormBuilder with Python: access FlexGridSizer from subclass -
i'm building gui in wxformbuilder , writing code in python.
i've noticed widgets i've built assigned self
in generated code. example, gui single piece of text might like:
class myframe(wx.frame): def __init__(self,parent): wx.frame.__init__(self,parent) self.mystatictext = wx.statictext(self,wx.id_any,'my text',0)
so object mystatictext
becomes attribute of myframe
class. good, because can write new class inherits 1 , perform other functions, such updating mystatictext
object:
import myfrmae class gui(myframe): def __init_(self,parent): myframe.__init__(self,parent) def updatetext(self): self.statictext.setlabel('my other text')
the problem wxformbuilder not append self
in front of flexgridsizer objects. generated code looks like:
myflexgridsizer = wx.flexgridsizer(3,1,0,0)
instead of:
self.myflexgridsizer = wx.flexgridsizer(3,1,0,0)
as result, cannot access object other class, need do.
so...
- is there way access object class if doesn't have
self
in front of it, if inherit directly? - is there way change setting in wxformbuilder append
self
?
if understand want access flexgridsizer
form builder has generated ?
i've never used wxformbuilder
think idea being is creates wxflexgridsizer
,manipulate in order layout of form, , calls setsizer
on wxwindow
( or wxframe
in case )and forget because layout not going change anymore.
one easy option (but it's not best) call getsizer
on frame , can access wxsizer
there.
the other option have specific sizer
member in myframe store wxflexgridsizer
, involve changing code generated wxformbuilder
Comments
Post a Comment