【发布时间】:2021-06-10 08:00:43
【问题描述】:
我与 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()
【问题讨论】:
-
按照@Idontknowsohelpme 的建议,尝试从终端启动可执行文件以查看任何错误消息。请将错误消息与您的问题一起发布。知道错误可以更容易(帮助您)解决问题。
标签: python python-3.x pyinstaller pysimplegui