简单wxpython框架外观源码

释放双眼,带上耳机,听听看~!

coding=utf-8

import wx
import time
app=wx.App()
win=wx.Frame(None,title=u”网站链接抓取”,size=(500,400))

zujian=wx.Panel(win)#win的组件
button_1=wx.Button(zujian,label=u’爬取’)
button_2=wx.Button(zujian,label=u’保存’)
http_1=wx.TextCtrl(zujian)
data_time=wx.Gauge(zujian, -1, 100, (100, 50), (200, 25), style = wx.GA_PROGRESSBAR)
count = 0
data_time.SetBezelFace(3)
data_time.SetShadowWidth(3)
def aaa(self):

for a in range(0,101):
    time.sleep(0.1)
    data_time.SetValue(a)
data_time.Center(True)

button_1.Bind(wx.EVT_BUTTON,aaa)#绑定事情触发函数
print_file=wx.TextCtrl(zujian,style=wx.TE_MULTILINE|wx.HSCROLL)

h=wx.BoxSizer()#尺寸器参数默认水平方向
h.Add(http_1,proportion=2,flag=wx.EXPAND)#可扩大可获取空间
h.Add(button_1,proportion=0,flag=wx.LEFT,border=5)#靠左宽度
h.Add(button_2,proportion=0,flag=wx.LEFT,border=5)
v=wx.BoxSizer(wx.VERTICAL)#尺寸器参数垂直方向
v.Add(h,proportion=0,flag=wx.EXPAND|wx.ALL,border=5)#v中的尺寸器h整体可扩大
v.Add(print_file,proportion=1,flag=wx.EXPAND|wx.LEFT|wx.BOTTOM|wx.RIGHT,border=5)
v.Add(data_time,proportion=0,flag=wx.LEFT,border=10)
zujian.SetSizer(v)
win.Show()
app.MainLoop()

【转自慕课】https://www.imooc.com

Python

PyQt5 最小化到托盘,升级小闹钟...

2022-3-3 16:31:33

Python

「自动化实战」手把手从python安装到setuptools、pip工具安装

2022-3-3 16:35:43

搜索