我试图让我的空框架,以便当我单击 X 时它只是隐藏窗口,然后如果我点击停靠图标它将显示窗口。事实证明,这比我预期的更具挑战性。我使用了http://wiki.wxpython.org/Optimizing%20for%20Mac%20OS%20X/但我无法结束它。
这是我的代码:
import wx
class Frame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "title",style=wx.SYSTEM_MENU | wx.CLOSE_BOX | wx.CAPTION, size=(300,300))
panel = wx.Panel(self)
def MacReopenApp(self, event):
print "Attempting to reveal the window."
def MacHideApp(self, event):
print "Attempting to hide the window."
if __name__ == '__main__':
app = wx.App()
frame = Frame()
frame.Show()
app.MainLoop()