I have the following code:
.....there are two problems.
1) i want the sizer (that is returned from buildTopPanel() ) to fill the
screen wide/tall. now the text control in it is very small in the
upper-left corner.
2) the scroll bars and borders on the text controls dont appear until i
mouse over them, any ideas?
thanks
Code:
class MainFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, wx.ID_ANY, title, style=wx.DEFAULT_FRAME_STYLE |wx.NO_FULL_REPAINT_ON_RESIZE) # build top area topSizer = self.buildTopPanel() # build input area inputSizer = self.buildInputPanel() mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(topSizer, 1, wx.EXPAND | wx.ALL, 5) mainSizer.Add(inputSizer, 1, wx.EXPAND | wx.ALL, 5) p = wx.Panel(self, wx.ID_ANY) p.SetSizer(mainSizer) s = wx.BoxSizer(wx.VERTICAL) s.Add(p, 1, wx.EXPAND) self.SetAutoLayout(True) self.SetSizer(s) self.Layout() def buildTopPanel(self): p = wx.Panel(self, wx.ID_ANY) self.text = wx.TextCtrl(p, wx.ID_ANY, style=wx.TE_MULTILINE | wx.SUNKEN_BORDER) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.text, 1, wx.EXPAND) return sizer def buildInputPanel(self): # the area to enter text self.text2 = wx.TextCtrl(self, wx.ID_ANY, style=wx.TE_MULTILINE | wx.SUNKEN_BORDER) # panel to add button to p = wx.Panel(self, wx.ID_ANY) self.buttonClick = wx.Button(p, wx.ID_ANY, "Click") hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add(self.buttonClick, 0, wx.ALIGN_CENTER) p.SetSizer(hsizer) # add the text control and button panel box = wx.BoxSizer(wx.HORIZONTAL) box.Add(self.text2, 1, wx.EXPAND) box.Add(p, 0, wx.EXPAND) return box if __name__ == "__main__": app = wx.PySimpleApp() frame = MainFrame(None, wx.ID_ANY, "Test") frame.Show() app.MainLoop()
1) i want the sizer (that is returned from buildTopPanel() ) to fill the
screen wide/tall. now the text control in it is very small in the
upper-left corner.
2) the scroll bars and borders on the text controls dont appear until i
mouse over them, any ideas?
thanks
Comment