wxpython使用多进程_wxPython 使用总结

图形化编写:

class MyFrame(wx.Frame):

def __init__(self,parent):

wx.Frame.__init__(self, parent, id=-1, title="Jira bug统计工具", size=(410, 335))

bkg = wx.Panel(self)

wx.StaticText(bkg, id=-1, label='用户名', pos=(50, 30), size=wx.DefaultSize, style=0, name="staticText")

wx.StaticText(bkg, id=-1, label='密码', pos=(220, 30), size=wx.DefaultSize, style=0, name="staticText")

wx.StaticText(bkg, id=-1, label='项目名称', pos=(30, 150), size=wx.DefaultSize, style=0, name="staticText")

wx.StaticText(bkg, id=-1, label='测试轮次', pos=(30, 190), size=wx.DefaultSize, style=0, name="staticText")

execButton = wx.Button(parent = bkg, id=-1, label='执行', pos=(300, 160))

self.username = wx.TextCtrl(bkg, id=-1, pos=(40, 50), size=(150, -1), name='TC01') # 用户名输入框

self.password = wx.TextCtrl(bkg, id=-1, pos=(200, 50), size=(150, -1), style = wx.TE_PASSWORD) # 密码输入框

projectList = ['项目1', '项目2', '项目3', '项目4']

self.projectname = wx.ComboBox(bkg, pos=(85, 150), size=(185, -1), choices=projectList) # 项目名称下拉框

timeList = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15']

self.times = wx.ComboBox(bkg, id=-1, pos=(85, 190), size=(185, -1), choices=timeList) # 测试轮次下拉框

事件绑定:

1.定义事件函数

def Exec(self,evt):

username = self.username.GetValue()

password = self.password.GetValue()

projectname = self.projectname.GetValue()

times = self.times.GetValue()

with open('txt.txt','w+') as f:

f.write('username={},password={},projectname={},times={}'.format(username, password, projectname, times))

2.绑定触发事件的条件

self.Bind(wx.EVT_BUTTON, self.Exec, execButton)

完整代码:

import wx

class MyFrame(wx.Frame):

def __init__(self,parent):

wx.Frame.__init__(self, parent, id=-1, title="Jira bug统计工具", size=(410, 335))

bkg = wx.Panel(self)

wx.StaticText(bkg, id=-1, label='用户名', pos=(50, 30), size=wx.DefaultSize, style=0, name="staticText")

wx.StaticText(bkg, id=-1, label='密码', pos=(220, 30), size=wx.DefaultSize, style=0, name="staticText")

wx.StaticText(bkg, id=-1, label='项目名称', pos=(30, 150), size=wx.DefaultSize, style=0, name="staticText")

wx.StaticText(bkg, id=-1, label='测试轮次', pos=(30, 190), size=wx.DefaultSize, style=0, name="staticText")

execButton = wx.Button(parent = bkg, id=-1, label='执行', pos=(300, 160))

self.username = wx.TextCtrl(bkg, id=-1, pos=(40, 50), size=(150, -1), name='TC01') # 用户名输入框

self.password = wx.TextCtrl(bkg, id=-1, pos=(200, 50), size=(150, -1), style = wx.TE_PASSWORD) # 密码输入框

projectList = ['项目1', '项目2', '项目3', '项目4']

self.projectname = wx.ComboBox(bkg, pos=(85, 150), size=(185, -1), choices=projectList) # 项目名称下拉框

timeList = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15']

self.times = wx.ComboBox(bkg, id=-1, pos=(85, 190), size=(185, -1), choices=timeList) # 测试轮次下拉框

self.Bind(wx.EVT_BUTTON, self.Exec, execButton)

def Exec(self,evt):

username = self.username.GetValue()

password = self.password.GetValue()

projectname = self.projectname.GetValue()

times = self.times.GetValue()

with open('txt.txt','w+') as f:

f.write('username={},password={},projectname={},times={}'.format(username, password, projectname, times))

class MyApp(wx.App):

def OnInit(self):

self.frame=MyFrame(parent=None)

self.SetTopWindow(self.frame)

self.frame.Show(True)

return True

if __name__ == '__main__':

app = MyApp()

app.MainLoop()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值