Expand an wxChoice object from xrc file

30 views
Skip to first unread message

robert....@gmail.com

unread,
Mar 24, 2017, 6:40:07 PM3/24/17
to wxPython-users
Hi,
I have this piece of xrc file, used to build the gui:

  <object class="wxPanel" name="panel1">
   
<object class="wxBoxSizer">
     
<orient>wxHORIZONTAL</orient>
     
<object class="sizeritem">
       
<object class="wxBoxSizer">
   
         
<object class="sizeritem">
           
<object class="wxBoxSizer">
   
             
<orient>wxVERTICAL</orient>
   
             
<object class="sizeritem">
               
<object class="wxStaticText">
               
<label>Item:</label>
             
</object>
             
<flag>wxRIGHT|wxALIGN_CENTRE_VERTICAL</flag>
             
<ratio>0</ratio>
           
</object>
   
           
<object class="sizeritem">
             
<object class="wxChoice" name="SelectItem">
               
<label>Select item</label>
             
</object>
             
<flag>wxALL|wxEXPAND|wxALIGN_CENTRE</flag>
             
<ratio>0</ratio>
           
</object>

The problem is that the wxChoice object doesn't expand.
Any idea?

Thank you very much.

Tim Roberts

unread,
Mar 26, 2017, 1:41:45 AM3/26/17
to wxpytho...@googlegroups.com
Are you editing this file by hand?  Because the nesting here does not seem to be correct.  You have:

  horizontal box sizer
    sizer item #1
      box sizer (unknown orientation)
        sizer item #2
          vertical box sizer
            sizer item #3
              static text
         sizer item #4
           wxChoice

The problem here (which is difficult to see with the spacing) is that the wxChoice sizer item #4 is nested inside sizer item #2.  The sizer items should all be peers of each other, and each sizer item should contain exactly one control.  I can't tell what layout you're really looking for here; is the wxChoice supposed to be inside of the vertical box sizer, or in the outer one?  And why do you have the extra sizer inside the horizontal box?             
— 
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

robert....@gmail.com

unread,
Mar 27, 2017, 4:56:59 AM3/27/17
to wxPython-users
Thanks Tim, you were right!

Robert.
Reply all
Reply to author
Forward
0 new messages