简体   繁体   中英

Why My py2app is not working , launch error

I built my app, :


import os, shutil
import tkinter as tk
from tkinter import *
#Ca ouvre le fichier et prend la derniere et avant derniere ligne
with open('Secrets.txt', 'r') as f:
    last_line = f.readlines()[-1]
#Ca fait la fenetre
window = tk.Tk()
window.title("Rentre un secret")
window.geometry('1100x60')
#Ton secret
lbl = Label(window, text="Ton secret:")
lbl.grid(column=0, row=0)
txt = Entry(window,width=100)
txt.grid(column=1, row=0)
txt.pack
#ecrire dans le fichier txt ton secret
def enreg():
    "Enregistrer ton secret"
    obfichier = open('Secrets.txt','a')
    if txt.get():
        obfichier.write(txt.get()+"\n")
    obfichier.close()
    
bou2 = Button(window, text = 'Enregistrer', command = enreg)
bou2.grid(row = 1, column = 0)
#L'autre Secret
log = Label(window, text="L'ancien secret: " + last_line)
log.grid(column=1, row=1)
directorya = txt.get()

but when I do./dist/TonSecret.app/Contents/MacOS/TonSecret, it does nothing.. and when I click on the app icon it tells me: Launch error Launch error See the py2app website for debugging launch issues can u help me

py2app issues aside, this code doesn't do anything because you're never entering the tkinter event loop. Add this line to the end of your code and your code will do something:

window.mainloop()

If you want help in understanding why what you get when applying py2app doesn't work, you'll need to provide more information about just what you're doing to build your executable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM