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.
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 .
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 .