天天看点

WxPython实现无边框界面

wxPython是Python语言的一套优秀的GUI图形库。允许Python程序员很方便的创建完整的、功能键全的GUI用户界面。 wxPython是作为优秀的跨平台GUI库wxWidgets的Python封装和Python模块的方式提供给用户的。

实现无边框界面代码如下:

import wx

class Frame(wx.Frame):
    
    def __init__(self):#,pos=(0,0)
        wx.Frame.__init__(self,None,title = u"",pos=(10,10),size=(1340,670),style=wx.SIMPLE_BORDER|wx.TRANSPARENT_WINDOW)  
        self.Center(wx.CURSOR_WAIT)    
        self.SetMaxSize((1340,670))
        self.SetMinSize((1340,670))                                                                   
        self.panel = wx.Panel(self,size=(1340,670))
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        
        Close_Button = wx.Button(self.panel,label=u"关闭",pos=(1240,0),size=(100,45))
        
        self.Bind(wx.EVT_BUTTON,self.OnClose,Close_Button)
        
    def OnClose(self,event):
        self.Destroy()
        
if __name__ == "__main__":
    app = wx.App()
    frame = Frame()
    frame.Show()
    app.MainLoop()