我剛剛開始使用wxPython。我有以下代碼:防止面板在wxPython中重疊?
import wx
class SASFrame(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self,parent,id,title)
groupPanel = wx.Panel(self)
st = wx.StaticText(groupPanel, -1, "Which characteristics would you like to group by?")
cbAge = wx.CheckBox(groupPanel, -1, "Age")
cbMarket = wx.CheckBox(groupPanel,-1, "Market")
groupSizer = wx.BoxSizer(wx.VERTICAL)
groupSizer.AddMany([st,cbAge, cbMarket])
groupPanel.SetSizer(groupSizer)
summaryPanel = wx.Panel(self)
st2 = wx.StaticText(summaryPanel, -1, "What would you like to summarize?")
cbPremiums = wx.CheckBox(summaryPanel,-1, "Premiums")
cbClaims = wx.CheckBox(summaryPanel,-1, "Claims")
summarySizer = wx.BoxSizer(wx.VERTICAL)
summarySizer.AddMany([st2,cbPremiums,cbClaims])
summaryPanel.SetSizer(summarySizer)
frameSizer = wx.BoxSizer(wx.VERTICAL)
frameSizer.Add(groupPanel,1,wx.EXPAND)
frameSizer.Add(summaryPanel,1,wx.EXPAND)
self.SetSizer(frameSizer)
class SASApp(wx.App):
def __init__(self):
wx.App.__init__(self)
def OnInit(self):
self.frame = SASFrame(parent=None,id=-1,title="HCRFM Custom Report Generator")
self.frame.Show()
self.SetTopWindow(self.frame)
return True
def main():
app = SASApp()
app.MainLoop()
if __name__ == '__main__':
main()
當我調整窗口的大小,以便它是非常小的,它看起來像這樣:
我怎樣才能防止這種重疊?另外,我怎樣才能做到這一點,使用戶無法將窗口縮小到足以切斷水平文字?我不確定我是否應該擔心後者。