python用WxPython库实现无边框窗体和透明窗体实现方法详解
作者:WANG_DDD 时间:2021-09-04 18:48:45
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()
来源:https://blog.csdn.net/qq_27802435/article/details/88287279
标签:python,WxPython
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
解决Python httpx 运行过程中无限阻塞的问题
2023-03-26 12:17:05
Python列表的定义及使用
2023-08-02 03:38:32
![](https://img.aspxhome.com/file/2023/9/61759_0s.png)
Python实现滑雪小游戏
2023-08-10 15:30:03
![](https://img.aspxhome.com/file/2023/7/66397_0s.gif)
Python如何使用带有 for 循环的 Lambda 函数
2021-05-28 05:06:05
用VB生成DLL封装ASP代码一个例子:连接access数据库等
2008-04-07 13:06:00
asp简单可逆运算字符串加密解密函数
2010-05-04 16:42:00
pandas读取excel,txt,csv,pkl文件等命令的操作
2023-09-08 08:57:33
![](https://img.aspxhome.com/file/2023/8/80448_0s.jpg)
Python selenium文件上传方法汇总
2022-12-01 04:47:29
python中main函数(主函数)相关应用例子
2023-08-23 08:54:59
asp如何做一个只能从本站点才能访问的页面?
2010-07-12 19:00:00
解决Python的str强转int时遇到的问题
2023-02-28 23:03:02
Python实现的网页截图功能【PyQt4与selenium组件】
2021-04-13 16:21:56
如何使用repr调试python程序
2023-10-11 21:39:15
ASP XML制作菜单管理程序
2011-04-04 11:15:00
php将textarea数据提交到mysql出现很多空格的解决方法
2023-09-11 01:10:08
解决Pycharm 运行后没有输出的问题
2023-06-02 04:48:19
![](https://img.aspxhome.com/file/2023/9/90889_0s.jpg)
Python3 assert断言实现原理解析
2023-06-11 20:39:33
python 绘制正态曲线的示例
2023-08-22 10:52:14
![](https://img.aspxhome.com/file/2023/4/75884_0s.png)
Django中自定义模型管理器(Manager)及方法
2022-12-01 17:53:05
彻底弄懂CSS盒子模式之一(DIV布局快速入门)
2007-05-11 17:03:00
![](https://img.aspxhome.com/file/uploadpic/20075/200751117352545.gif)