首页 > 解决方案 > py2exe 不工作 - 闪烁控制台并关闭

问题描述

EXE 打不开。我已经尝试了我在网上找到的所有东西。当我运行 exe 时,控制台会打开几秒钟然后关闭。我怎样才能使这个.py可执行文件并有我的.txt输出?

from tkinter import *
import time, os, fnmatch, shutil

screen = Tk()
screen.geometry("600x450")
screen.configure(background='azure')
screen.title("M")
t = time.localtime()
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
BACKUP_NAME = ("backup-" + timestamp)
heading = Label(text = "Mr", font=(None, 15), bg = "lightblue", fg = "black", width = "500", height = "3")
heading.pack()
firstname_text = Label(text = "Name/ * ", bg = "azure",)
lastname_text = Label(text = "Usagel* ", bg = "azure",)
material_text = Label(text = "M * ", bg = "azure",)
age_text = Label(text = "How * ", bg = "azure",)
firstname_text.place(x = 15, y = 80)
lastname_text.place(x = 15, y = 140)
material_text.place(x = 15, y = 210)
age_text.place(x = 15, y = 260)
firstname = StringVar()
lastname = StringVar()
material = StringVar()
age = StringVar()
firstname_entry = Entry(textvariable = firstname, width = "30")
lastname_entry = Entry(textvariable = lastname, width = "30")
material_entry = Entry(textvariable = material, width = "30")
age_entry = Entry(textvariable = age, width = "30")
firstname_entry.place(x = 15, y = 100)
lastname_entry.place(x = 15, y = 170)
material_entry.place(x = 15, y = 240)
age_entry.place(x = 15, y = 290)
register = Button(screen,text = "Submit", font=(None, 10), width = "30", height = "2", command = save_info, bg = "lime green")
register.place(x = 15, y = 320)

标签: pythonpython-3.xtkinterpy2exe

解决方案


推荐阅读