Reputation: 11
When I only hade one TxtCtrl, it's right side would expand all the way to the windows edge. But after I created a vertical BoxSizer to and added the horizontal one to that, the TxtCtrol only had a width of about 100 pixels. Why is this?
import wx
class MainPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
top_box = wx.BoxSizer(wx.VERTICAL)
box1 = wx.BoxSizer(wx.HORIZONTAL)
box2 = wx.BoxSizer(wx.HORIZONTAL)
textureName = wx.TextCtrl(self, 1)
texturePath = wx.TextCtrl(self, 1)
box1.Add(wx.StaticText(self, 1, "Name: "), 0, wx.LEFT|wx.RIGHT|wx.TOP, 5)
box1.Add(textureName, 1, wx.ALIGN_LEFT|wx.RIGHT|wx.TOP, 5)
box2.Add(wx.StaticText(self, 1, "Path: "), 0, wx.LEFT|wx.RIGHT|wx.TOP, 5)
box2.Add(texturePath, 1, wx.ALIGN_LEFT|wx.RIGHT|wx.TOP, 5)
top_box.Add(box1)
top_box.Add(box2)
self.SetSizer(top_box)
class MainFrame(wx.Frame):
def __init__(self, parent, id):
title = "Exporter"
wx.Frame.__init__(self, parent, wx.ID_ANY, title,
size=(500, 420),
style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
self.panel = MainPanel(self)
self.Show()
if __name__ == "__main__":
app = wx.PySimpleApp()
frame = MainFrame(None, -1)
frame.Centre()
app.MainLoop()
pass
Upvotes: 1
Views: 57