How do I stretch a static box to fit horizontally on the frame?
Code:
class XPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
self.box = wx.StaticBox(self, -1, "X CONTROL PANEL")
self.bsizer = wx.StaticBoxSizer(self.box, wx.VERTICAL)
self.t = wx.StaticText(self, -1, "X command: ")
self.cmdtext = wx.TextCtrl(self, -1, "")
self.itpsend_btn = wx.Button(self, -1, " Send ")
self.bsizer.Add(self.t, 0, wx.TOP|wx.LEFT, 10)
self.bsizer.Add(self.cmdtext, 0 , wx.ALL|wx.EXPAND)
self.bsizer.Add(self.itpsend_btn, 0, wx.ALL|wx.CENTER)
self.border = wx.BoxSizer()
self.border.Add(self.bsizer, -1, wx.EXPAND|wx.ALL, 25)
self.SetSizer(self.border)
I'm getting this:

But I would like it to be strecthed in wide to fit the frame.
Please educate. Thanks.
Your XPanel is correct. Your problem is not in XPAnel but in the frame that holds this and other panels (from your image there is at least and additional panel).
Is in the frame that you must tell the panel to expand and fit the full frame. So , you must use wx.EXPAND as shown here:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With