Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, the issue is with how your accessing the information, try getting at it through the sizer:</p> <pre><code>self.tc_all = [] for child in self.inputsizer.GetChildren(): self.tc_all.append(child.GetWindow().GetValue()) self.tc_all = sorted(self.tc_all) for child,item in zip(self.inputsizer.GetChildren(),self.tc_all): child.GetWindow().SetValue(item) self.inputsizer.Layout() </code></pre> <p>So here's whats going on here. Every sizer has children called "sizer items" (documentation <a href="http://www.wxpython.org/docs/api/wx.SizerItem-class.html" rel="nofollow">here</a>) which are representations of your items on the GUI. Calling <code>GetChildren()</code> on any sizer will return a list of all of that sizer's sizer items. Note that these are note the items themselves, so you need to take one more step, and that is the <code>GetWindow()</code> function. The result of <code>GetWindow()</code> on a sizer item is to return the actual item (or widget) that the sizer item represents, in the case a <code>TextCtrl</code> item. Once you have that, you can treat is as you normally would. </p> <p><em><strong>BE CAREFUL</em></strong> when using the <code>GetChildren()</code> function on a sizer that contains multiple items, as it returns <strong>all</strong> the children. So your code will break if you try to call <code>SetValue()</code> on something which does not support that method, such at <code>StaticText</code></p> <p>Hope this helps</p> <p><strong>EDIT:</strong> The actual answer was an issue with sizers resulting from nesting panels. Editing the sizers in the nested panel caused the strange behavior noted in the question.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload