2014-01-10 43 views
1

了良好的效果:在wx.lib.agw.ribbon只有一個的SimpleButton造成不良佈局

enter image description here

壞的結果:

enter image description here

我沒有用戶體驗與色帶接口,因此無法理解會發生什麼:

  • 這是一個錯誤?
  • 或者它是打算的行爲,我應該以某種方式調整佈局?

代碼:

import wx 
import wx.lib.agw.ribbon as RB 
#import ribbon as RB 

class MyDialog(wx.Dialog): 
    def __init__(self, *ls, **kw): 
    wx.Dialog.__init__(self, *ls, **kw) 
    ribbon = RB.RibbonBar(self, -1) 

    page = RB.RibbonPage(ribbon, wx.ID_ANY, "Page") 
    panel = RB.RibbonPanel(page, wx.ID_ANY, "Create Project") 
    bbar = RB.RibbonButtonBar(panel) 
    bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_OTHER, wx.Size(48, 48)) 
    bbar.AddSimpleButton(wx.ID_ANY, "New", bmp, '') 
    #bbar.AddSimpleButton(wx.ID_ANY, "New2", bmp, '') # uncomment for the good result 

    ribbon.Realize() 
    s = wx.BoxSizer(wx.VERTICAL) 
    s.Add(ribbon, 0, wx.EXPAND) 
    self.SetSizer(s) 

app = wx.PySimpleApp() 
dlg = MyDialog(None, title="Test Ribbon", size=(200,150)) 
dlg.ShowModal() 
dlg.Destroy() 

回答

相關問題