Dynamically generated control arrays: more elegant getters?
Alexandru Tabac
alexandru.tabac at gmail.com
Thu Jan 3 14:30:17 PST 2008
Hi, guys.
I currently have a function that dynamically adds a BoxSizer to
another sizer each time I click a button.
Inside the BoxSizer there are a bunch of StaticText and TextCtrl
controls. All blissful anonymous, as are the BoxSizers.
Now, I do need the data from the TextCtrl-s, obviously, but my current
approach might be lacking.
Is there a better way to yank the data from the controls without a
double cycle of
sizerItemList=self.containerSizer.GetChildren()
for eachSizerItem in sizerItemList:
controlSizerItems=eachSizerItem.GetSizer().GetChildren()
for controlSizerItem in controlSizerItems:
if isinstance(controlSizerItem.GetWindow(), wx.TextCtrl):
#finally get values here.
I don't see a better solution, and perhaps there is none, and there
are more ugly things in the world than this.
I just started learning wxPython last week, and maybe there is some
"Get_All_TextCtrl_Values_Recursively_From_That_Pile_Of_Sizers"
function I'm not seeing ;) Just curious.
More information about the wxpython-users
mailing list