如何将菜单栏添加到wx.grid框架? 我搜索了很多,找不到解决这个问题的方法。
答案 0 :(得分:0)
您不会将其添加到网格中,而是将网格和菜单栏添加到框架中,如下所示:
#!/usr/bin/python
import wx
import wx.grid
class GridAndMenuFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title,
wx.DefaultPosition, wx.Size(200, 150))
mbar = wx.MenuBar()
menu = wx.Menu()
menu.Append(101, 'E&xit', 'Exit')
mbar.Append(menu, '&File')
self.SetMenuBar(mbar)
grid = wx.grid.Grid(self, -1)
# obviously, size and configure the grid here
if __name__ == '__main__':
app = wx.App(redirect=False)
win = GridAndMenuFrame(None, -1, "grid and menu")
win.Show()
app.MainLoop()