wxpython panel fullscreen?

前端 未结 3 932
暖寄归人
暖寄归人 2021-01-28 04:55

I am trying to make my top_panel of my program go into fullscreen only, i hope to have a button which will do this, the issue i am faced with is i dont know how to make the pane

3条回答
  •  余生分开走
    2021-01-28 05:19

    I have written about this subject on my blog. Here's an example:

    import wx
    
    
    class MyPanel(wx.Panel):
        """"""
    
        def __init__(self, parent):
            """Constructor"""
            wx.Panel.__init__(self, parent)
    
            self.Bind(wx.EVT_KEY_DOWN, self.onKey)
    
        def onKey(self, event):
            """
            Check for ESC key press and exit is ESC is pressed
            """
            key_code = event.GetKeyCode()
            if key_code == wx.WXK_ESCAPE:
                self.GetParent().Close()
            else:
                event.Skip()
    
    
    class MyFrame(wx.Frame):
        """"""
    
        def __init__(self):
            """Constructor"""
            wx.Frame.__init__(self, None, title="Test FullScreen")
            panel = MyPanel(self)
            self.ShowFullScreen(True)
    
    
    if __name__ == "__main__":
        app = wx.App(False)
        frame = MyFrame()
        app.MainLoop()
    

    I have noticed that this code doesn't seem to work with Macs.

提交回复
热议问题