程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python test script adding input parameter interface GUI

編輯:Python

Preface

Python Test scripts can use pyinstaller Package and export as exe Format , So you can windows The desktop executes this test script , There is no need to install python And related dependent packages .

Some test scripts need to enter parameters in the code , For example, file path 、 file name 、 The channel number 、 Sampling rate, etc , Packaging for exe After the executable file, you can no longer open the code input parameters , At this time, you need to double-click exe The input box can pop up after the file , Enter the parameters required by the program . This article is about input parameters GUI turn , This article uses GUI Dependent libraries are EasyGUI.

What is? EasyGUI

EasyGUI yes python One of them is very simple GUI Programming module , Different from other GUI generator , It is not event driven , contrary , be-all GUI Interaction can be realized through simple function calls ( intend : Function calls can be implemented GUI).

EasyGUI That's right TKinter The advanced packaging of , The advantage is that it is easy to use , You don't need to know any framework 、 Part or callback , Just call an existing function .

Test window GUI

EasyGUI There are about thirty in the GUI function , What we mainly use here is multenterbox function ( Multiline input function ). The specific code is as follows :

import easygui as eg
msg = '** Technology access test procedures '
title = ' Information input interface '
filenames = ['filepath','filename','MIC Channel number ',' Mining channel No ']
file_value = []
file_value = eg.multenterbox(msg,title,filenames)
print(file_value)
filepath = file_value[0]
print('filepath',filepath)
filename = file_value[1]
print('filename',filename)
micseq = file_value[2]
print('micseq',micseq)
refseq = file_value[3]
print('refseq',refseq)

Display... After execution GUI The interface is as follows :

Enter the parameters :

print result :

Then the program calls this 4 Just one parameter .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved