开发者

wxpython GridBagSizer problem

开发者 https://www.devze.com 2023-02-18 23:01 出处:网络
when ever I use span in GridBagSizer I get a problem, here\'s my code: hbox3.Add(arrangeLabel) hbox3.Add(self.arrangeComboBox, flag=wx.LEFT, border=10)

when ever I use span in GridBagSizer I get a problem, here's my code:

    hbox3.Add(arrangeLabel)
    hbox3.Add(self.arrangeComboBox, flag=wx.LEFT, border=10)
    sizer.Add(hbox3, pos=(7,0), span=(7,3), flag=wx.ALL, border=15)

    #######################
    hbox4 = wx.BoxSizer(开发者_JAVA百科wx.HORIZONTAL)
    runButton = wx.Button(panel, -1, label='Run', size=(50,25))
    saveButton = wx.Button(panel, -1, label='Save', size=(50,25))
    cancelButton = wx.Button(panel, -1, label = 'Cancel', size=(50,25))

    hbox4.Add(runButton)
    hbox4.Add(saveButton, flag=wx.LEFT, border=10)
    hbox4.Add(cancelButton, flag=wx.LEFT, border=10)

    sizer.Add(hbox4, pos=(8,0), flag=wx.ALIGN_CENTER_HORIZONTAL)

    sizer.AddGrowableCol(1)
    panel.SetSizer(sizer)

on the third line, i have my hbox3 spanning from 7,0 to 7,3. This is somehow affecting my 8th row, my 8th row will disappear into the corner of the window. Even if I change pos=(8,0) to pos=(9,0) I still get the same problem. The only way I can solve it is to take away the span=(7,3), which makes my GUI look very ugly.

What is my problem here?


I think you're misunderstanding the span argument. span=(7,3) is telling the sizer to stretch the widget across 7 rows and 3 columns from its starting position. If you want it to cover 7,0 to 7,3, try span=(1,4).

0

精彩评论

暂无评论...
验证码 换一张
取 消