Wie kann ich dem Inhalt eines Notebook-Tabs sagen, dass es sich der Fenstergröße anpassen soll? Das Notebook selber resizt wunderbar, nur der Inhalt bleibt statisch. Hab ich da was übersehen?
Danke schonmal, ich hofffe mir kann jemand helfen...
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
import wx
import wx.grid
class MyFrame(wx.Frame):
def __init__(self, title, pos, size, style):
wx.Frame.__init__(self, None, -1, title, pos, size, style)
self.PnlFrame = wx.Panel(self, -1)
BxsFrame = wx.BoxSizer(wx.VERTICAL)
self.__init__NbMain()
BxsFrame.Add(self.NbMain,1, flag=wx.EXPAND)
self.PnlFrame.SetSizer(BxsFrame)
BxsFrame.Fit(self)
def __init__NbMain(self):
self.NbMain = wx.Notebook(self.PnlFrame, -1, style=wx.NB_NOPAGETHEME)
self.PnlMain = self.__init__PnlMain()
self.NbMain.AddPage(self.PnlMain, 'Allgemein')
self.NbMain.Fit()
def __init__PnlMain(self):
Pnl = wx.Panel(self.NbMain, -1)
Gbs = wx.GridBagSizer(0,0)
BxsAlpha = wx.BoxSizer(wx.HORIZONTAL)
LblAlpha = wx.StaticText(Pnl, -1, 'Alpha:')
self.TxtAlpha = wx.TextCtrl(Pnl, -1)
BxsAlpha.Add(LblAlpha, 0, flag=wx.ALIGN_CENTER|wx.RIGHT, border=5)
BxsAlpha.Add(self.TxtAlpha, 0, flag=wx.ALIGN_CENTER)
Gbs.Add(BxsAlpha,(0,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
BxsBeta = wx.BoxSizer(wx.HORIZONTAL)
LblBeta = wx.StaticText(Pnl, -1, 'Beta:')
self.ChcBeta = wx.Choice(Pnl, -1, choices=['eins','zwei','drei'])
BxsBeta.Add(LblBeta, 0, flag=wx.ALIGN_CENTER|wx.RIGHT, border=5)
BxsBeta.Add(self.ChcBeta, 0, flag=wx.ALIGN_CENTER)
Gbs.Add(BxsBeta,(0,1), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
self.GrdEpsilon = wx.grid.Grid(Pnl, -1)
self.GrdEpsilon.CreateGrid(5,5)
for i in range(5):
self.GrdEpsilon.SetColLabelValue(i, str(i))
Gbs.Add(self.GrdEpsilon, (1,0), (1,2), flag=wx.EXPAND|wx.ALL, border=5)
Pnl.SetSizer(Gbs)
Gbs.Fit(Pnl)
return Pnl
class MyApp(wx.App):
def __init__(self, redirect=False):
wx.App.__init__(self, redirect)
def OnInit(self):
self.Frame = MyFrame('Notebook Test', wx.DefaultPosition, wx.DefaultSize, wx.DEFAULT_FRAME_STYLE)
self.Frame.Show()
self.SetTopWindow(self.Frame)
return True
if __name__ == '__main__':
app = MyApp()
app.MainLoop()