我发现“ShowFullscreen”可以全屏显示。第一帧(MyFrame)是全屏。但我无法制作全屏其他对话框(emerg_Dialog 和 call_Dialog) 我不想在对话框中看到任何标题或工具栏。
# -*- coding: utf-8 -*-
#!/usr/bin/python
import wx
import wx.media
class emerg_Dialog(wx.Dialog):
def __init__(self, parent, id, title):
wx.Dialog.__init__(self, parent, id, title, size=(1280,800))
if self.IsFullScreen():
self.ShowFullScreen(False)
else:
self.ShowFullScreen(True)
self.SetBackgroundColour(wx.Colour(100,0,0))
class call_Dialog(wx.Dialog):
def __init__(self, parent, id, title):
wx.Dialog.__init__(self, parent, id, title, size=(1280,800))
class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(1280,800))
self.SetBackgroundColour(wx.Colour(7,56,99))
button_1 = wx.Button(self, label="emerg", pos=(100,550), size=(300,150))
button_1.Bind(wx.EVT_BUTTON, self.OnEmerg)
button_cancel = wx.Button(self, label="destory", pos=(490,550), size=(300,150))
button_cancel.Bind(wx.EVT_BUTTON, self.OnCloseWindow)
button_2 = wx.Button(self, label="call", pos=(490,550), size=(300,150))
button_2.Bind(wx.EVT_BUTTON, self.OnCall)
def OnEmerg(self, event):
emerg = emerg_Dialog(self, -1, '')
#self.ShowFullScreen(self.IsFullScreen(), wx.FULLSCREEN_ALL)
# self.emerg.ShowFullScreen(True)
# self.emerg.SetTopWindow(self.main)
emerg_1 = emerg.ShowModal()
emerg.Destroy()
def OnCall(self, event):
call = call_Dialog(self, -1, '')
call1 = call.ShowModal()
call1.Destroy()
def OnCloseWindow(self, event):
self.Destroy()
# def OnFullScreen(self,event):
# self.ShowFullScreen(not self.IsFullScreen(), wx.FULLSCREEN_ALL)
class TestApp(wx.App): ##
def OnInit(self):
self.main = MyFrame(None,-1,'')
self.main.Show()
self.main.ShowFullScreen(True)
self.SetTopWindow(self.main)
return True
def main():
application = TestApp(redirect=False)
application.MainLoop()
if __name__=='__main__':
main()