import wx
class NoCaptionFrame(wx.Frame):
def __init__(self):
no_caption = wx.RESIZE_BORDER
wx.Frame.__init__(self, None, title="No Caption", style=no_caption)
toolbar = self.CreateToolBar(style=wx.TB_VERTICAL)
quittool1 = toolbar.AddLabelTool(wx.ID_ANY, 'Quit', wx.Bitmap('exit.png'))
quittool2 = toolbar.AddLabelTool(wx.ID_ANY, 'Quit', wx.Bitmap('exit.png'))
quittool3 = toolbar.AddLabelTool(wx.ID_ANY, 'Quit', wx.Bitmap('exit.png'))
toolbar.Realize()
menubar=wx.MenuBar()
first=wx.Menu()
second=wx.Menu()
first.Append(1,"New Window","This is a new window")
first.Append(2,"Open...","Open A New Window")
menubar.Append(first,"File")
menubar.Append(second,"Edit")
self.SetMenuBar(menubar)
self.Bind(wx.EVT_TOOL, self.OnQuit, quittool1)
self.Show()
def OnQuit(self, e):
self.Close()
if __name__ == "__main__":
app = wx.App()
frame = NoCaptionFrame()
app.MainLoop()
菜单栏专门用于菜单,我认为你正在寻找'wx.ToolBar'。请参阅'wx.Frame.CreateToolBar()'https://wxpython.org/Phoenix/docs/html/wx.Frame.html#wx.Frame.CreateToolBar –
我不知何故知道这一点。 :D 1.我没有水平工具栏和2的地方。哦,请,那个表情告诉我。我需要它看起来好像窗口在右上角有标准控件。 – Dalen
工具栏可能是垂直的!但是,在Linux上,系统菜单和关闭和最小化按钮不会在全屏模式下消失,所以我无法复制您的环境,因为我拒绝在机器上放置“窗口”。 –