wxPython是Python语言的一套优秀的GUI图形库。允许Python程序员很方便的创建完整的、功能键全的GUI用户界面。
wxPython是作为优秀的跨平台GUI库wxWidgets的Python封装和Python模块的方式提供给用户的。
下面的2个实例代码是实现wxPython窗体特殊效果演示大家可以研究下
wxPython无边框窗体实现代码如下:
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()
wxPython窗体实现透明代码如下:
#!/usr/bin/env python
#coding:utf-8
from wx import *
class Trans(Frame):
def __init__(self, parent, id, title):
Frame.__init__(self, parent, id, title, size=(700, 500), style=DEFAULT_FRAME_STYLE | STAY_ON_TOP)
self.Text = TextCtrl(self, style=TE_MULTILINE | HSCROLL)
self.Text.SetBackgroundColour('Black'), self.Text.SetForegroundColour('Steel Blue')
self.SetTransparent(200) #设置透明
self.Show()
app = App()
Trans(None, 1, "Transparent Window")
app.MainLoop()
更多关于python GUI图形库WxPython使用方法或实例大家可以查看下面的相关链接