问题描述
我正在制作一个使用tkinter作为GUI制造商向用户输入 x 次垃圾邮件的应用,当我运行python3 setup.py py2app -A
时,它打开的很好,但是当我运行时它没有别名规范。每当我尝试打开它时,它就会向我显示this error。我尝试指定--onefile
和-F
,但还是没有运气。我正在运行macOS Big Sur Beta,但是在Mojave系统上却遇到相同的问题。以下是我的python脚本:
from tkinter import *
from tkinter import messagebox
import tkinter as tk
import pyautogui
import time
root = Tk()
Label(root,text=" ").pack()
root.title("Spam Bot")
root.minsize(300,300)
root.geometry("350x350+450+250")
global ok
Label(root,text="Enter a word or phrase to spam: ").pack()
input = Entry(root)
input.pack()
Label(root,text="How many times should it be repeated?").pack()
rep = Entry(root)
rep.pack()
Label(root,text=" ").pack()
Label(root,text="Notice: You have 5 seconds to select").pack()
Label(root,text="the text field of a messaging app.").pack()
def countdown(count):
#if len(input.get()) != 0 and len(rep.get()) != 0:
# change text in label
timer['text'] = count
if count > 0:
# call countdown again after 1000ms (1s)
root.after(1000,countdown,count - 1)
elif count <= 0:
for f in range(int(rep.get())):
pyautogui.typewrite(input.get())
time.sleep(0.5)
pyautogui.press('enter')
continue
success.config(text="Spam Bot started successfully!")
def ifEmpty():
if len(input.get()) == 0: # empty!
messagebox.showerror("Error","Please enter something to spam!")
if len(rep.get()) != 0:
try:
int(rep.get())
except:
messagebox.showerror("Error",'"' + rep.get() + '"' " is not a number!")
ok = False
else:
ok = True
elif len(rep.get()) == 0:
messagebox.showerror("Error","Please enter the number of repetitions.")
if len(input.get()) != 0 and len(rep.get()) != 0 and ok == True:
countdown(3)
Label(root,text=" ").pack()
enter = Button(root,text="Spam!",command=lambda:[ifEmpty()],padx=10,pady=10)
enter.pack()
success = Label(root,text=" ")
Label(root,text=" ").pack()
timer = Label(root,text="")
timer.pack()
success.pack()
root.mainloop()```
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)