我与PySimpleGUI一起开发了一个python脚本。现在我正试图将其转换为独立文件,但当我使用PyInstaller创建EXE文件时,可执行文件就是不起作用。我双击,什么也没有出现。我相信我的py文件中有错误,导致PySimpleGUI窗口无法显示。 下面是我代码的一部分:
sg.theme('DarkTeal9')
ttk_style = ''
layout = [
[sg.T(ttk_style)],
[sg.Text('APP', font=("Calibri", 20))],
[sg.Text(' ')],
[sg.Text('Fichero ARC Laurea:'), sg.Input(), sg.FileBrowse()],
[sg.Text('Fichero Oferta Laurea:'), sg.Input(), sg.FileBrowse()],
[sg.Text('Fichero Nóminas:'), sg.Input(), sg.FileBrowse()],
[sg.Button('Procesar',bind_return_key=True,use_ttk_buttons=True)],
[sg.Text('Ventana de progreso:')],
[sg.Output(size=(75,25),key='inputbox')],
[sg.Text(' ')]]
iconpath=\somepathtoimage
window = sg.Window('myapp',icon=iconpath, ttk_theme=ttk_style).Layout(layout)
while True:
event, values = window.Read()
if event in (None, 'Exit'):
break
if event == 'Procesar':
arc_ruta=values[0]
propuestas_ruta=values[1]
nominas_ruta=values[2]
generar_propuestas(arc_ruta, propuestas_ruta, nominas_ruta) #calling the function
elif event == 'Process':
for filename in glob.glob(os.path.join(path, '*.xlsx')):
with open(filename,'rb') as f:
pdf = f.read()
window.close()
function()
我认为您丢失了这些文件,如果您从CMD打开exe,在exe所在的位置打开CMD并“/yourapp.exe”,您可以看到错误
此外,您还必须启用调试模式,您可以在pyinstaller的.spec文件中进行这些更改
这是我的样本:
您必须在数据中添加所需的所有文件,如上图所示 例如,您有一个包含图像的文件夹 首先设置文件夹,然后设置必须放入文件夹的文件类型
相关问题 更多 >
编程相关推荐