wxPython多個視窗的基本結構
阿新 • • 發佈:2020-01-09
如何在一個wxpython APP裡面建立兩個框架呢?供大家參考,具體內容如下
程式碼:
import ... import ... class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__( ... class MyFrame2(wx.Frame): def __init__(self): wx.Frame.__init__( ... class MyApp(wx.App): def OnInit(self): self.myframe = MyFrame() self.myframe2 = MyFrame2() self.SetTopWindow(self.myframe) self.myframe.Show(True) self.myframe2.Show(True) return True if __name__=='__main__': app = MyApp(0) app.MainLoop()
小編為大家又蒐集瞭如何實現簡單的wxpython兩個窗體?具體程式碼如下
import wx class MyFrame(wx.Frame): """ 一個簡單繼承Frame的例子. """ def __init__(self,parent,title): wx.Frame.__init__(self,title=title,size=(200,100)) self.control = wx.TextCtrl(self,style=wx.TE_MULTILINE) self.Show(True) app = wx.App(False) frame = MyFrame(None,'最簡單的編輯框程式') frame2 = MyFrame(None,'sssss') app.MainLoop()
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支援我們。