wxpython窗口置顶和禁用父窗口例子

xiaohai 2020-10-17 22:31:32 2720人围观 标签: Python 
简介wxpython窗口置顶和禁用父窗口例子

wxpython窗口置顶和禁用父窗口例子

#coding=utf-8
import wx
import time
class TwoFrame(wx.Frame):
    def __init__(self,parent):
        self.parent = parent
        wx.Frame.__init__(self, parent, -1,style=wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|wx.CLOSE_BOX|wx.RESIZE_BORDER|wx.SYSTEM_MENU|wx.CAPTION|wx.FRAME_FLOAT_ON_PARENT)
        self.Show()
        parent.Enable(False)
        self.Bind(wx.EVT_CLOSE,self.OnCloseFame)
    def OnCloseFame(self,event):
        self.parent.Enable(True)
        self.Destroy()
class MyFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self,None,-1,style=wx.DEFAULT_FRAME_STYLE)
        panel = wx.Panel(self,-1)
        wx.Button(panel,-1,'aaaaa')
        print 'aaaaa'
        panel.Bind(wx.EVT_LEFT_DOWN, self.OnMouse)
        self.Show()
        TwoFrame(self)

    def OnMouse(self,event):
        print 1

if __name__ == '__main__':
    app = wx.App()
    frame = MyFrame()
    app.MainLoop()