日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

wxpython收费吗_wxPython 使用总结

發布時間:2023/12/19 python 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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()

總結

以上是生活随笔為你收集整理的wxpython收费吗_wxPython 使用总结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。