擅长:python、mysql、java
<p>我几个月前就回答了这样的问题:<a href="https://stackoverflow.com/questions/12031522/wxpython-how-to-get-sizer-from-wx-statictext">wxPython: How to get sizer from wx.StaticText?</a></p>
<p>基本上,你只需要这样做:</p>
<pre><code>children = self.sizer.GetChildren()
for child in children:
widget = child.GetWindow()
print widget
if isinstance(widget, wx.TextCtrl):
widget.Clear()
</code></pre>
<p>在这种情况下,你可以看到我只是在检查wx.TextCtrl,但您可以检查任何您喜欢的小部件。我还写了一篇关于我的<a href="http://www.blog.pythonlibrary.org/2012/08/24/wxpython-how-to-get-children-widgets-from-a-sizer/" rel="nofollow noreferrer">blog</a>主题的文章。在</p>