好结果:
糟糕的结果:
我没有使用功能区界面的用户体验,因此无法理解会发生什么:
代码:
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()
答案 0 :(得分:0)
似乎有一个错误。如果RibbonPanel
上的文字长于其内容,则会中断。试试这个:
panel = RB.RibbonPanel(page, wx.ID_ANY, "Create...")
您可以在按钮旁边添加一些空小部件来克服此问题。
这里有一套很好的文档和示例: