TextCtrl fully expanding at program start

alex alecla at bluewin.ch
Fri Feb 27 07:46:37 EST 2009


Hi all
I have a gridsizer consisting of two vertically stacked panels, one
with a StaticBox and the other with a TextCtrl.
I would like that the TextCtrl expands at program start fully to the
allocated panel size (lower panel of gridSizer).
Instead of like now, fully expanding in the width but not exapnding in
the height direction (two lines high).

I am currently running in circles so maybe can anybody help me?
See below for my best effort (OS WinXP, Python 2.5).

Thank you, regards Alex



import wx

class Frame(wx.Frame):
    def __init__(self, title, pos, size):
        wx.Frame.__init__(self, None, -1, title, pos, size)

        self.panel = wx.Panel(self)
        self.panel.SetBackgroundColour(wx.Colour(220, 220, 220))

        box1 = wx.StaticBox(self.panel, -1, "Program Preferences")
        box2 = wx.TextCtrl(self.panel, -1, size=(-1,-1),style =
wx.TE_MULTILINE|wx.TE_READONLY)


        gs = wx.GridSizer(2, 1, 0, 0)
        windowOneSizer = wx.BoxSizer(wx.VERTICAL)
        windowTwoSizer = wx.BoxSizer(wx.VERTICAL)

        windowOneSizer.Add(box1, 0, wx.ALL|wx.EXPAND, 0)
        windowTwoSizer.Add(box2, 0, wx.ALL|wx.EXPAND, 0)

        gs.Add(windowOneSizer, 0, wx.ALL|wx.EXPAND, 2)
        gs.Add(windowTwoSizer, 0, wx.ALL|wx.EXPAND, 2)

        self.panel.SetSizer(gs)
        self.Centre()
        self.Show(True)


class App(wx.App):
    def OnInit(self):
        frame = Frame("My Frame", (100, 100), (400, 250))
        frame.Show()
        self.SetTopWindow(frame)
        return True
#
#
if __name__ == '__main__':
#
    app = App()
    app.MainLoop()
#
#




More information about the Python-list mailing list