【发布时间】:2011-11-20 03:08:52
【问题描述】:
我刚刚开始使用 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()
当我调整窗口大小使其非常小时,它看起来像这样:
如何防止这种重叠?另外,我怎样才能使用户无法使窗口小到足以切断水平方向的文本?我不确定我是否应该担心后者。
【问题讨论】:
标签: wxpython