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上,系統菜單和關閉和最小化按鈕不會在全屏模式下消失,所以我無法複製您的環境,因爲我拒絕在機器上放置「窗口」。 –