【发布时间】:2026-02-08 21:10:02
【问题描述】:
当我运行并按下开始按钮时我制作了 facebook 脚本我收到了这个错误我用 Tkinter 制作了这个 GUI 界面我正在使用 python 3 我的错误是当我点击开始按钮时他没有启动谷歌浏览器当我禁用 Tkinter 并通过命令行工作时,他可以正常工作,您可以看到错误屏幕截图:
import pyautogui as pg
import time
from selenium import webdriver
from getpass import getpass
from tkinter import *
window = Tk()
window.title('Facebook Sharing')
text = Label(window, text='Facebook Sharing Script', font="Source_Sans_Pro 20 bold")
text.pack()
frame = Frame(window)
frame.pack()
one = Frame(window)
one.pack( side = TOP )
frontframe = Frame(window)
frontframe.pack( side = TOP )
bottomframe = Frame(window)
bottomframe.pack( side = TOP )
lastframe = Frame(window)
lastframe.pack( side = TOP )
last = Frame(window)
last.pack( side = TOP )
Lable1 = Label(frame, text="Enter Your UserName! ", font='Source_Sans_Pro 11')
Lable1.pack( side = LEFT)
user_name = Entry(frame, bd =5)
user_name.pack(side = RIGHT)
Lable2 = Label(frontframe, text="Enter Your Passowrd! ", font='Source_Sans_Pro 11')
Lable2.pack( side = LEFT)
Password = Entry(frontframe, bd =5)
Password.pack(side = RIGHT)
Lable3 = Label(bottomframe, text="Enter Your Description! ", font='Source_Sans_Pro 11')
Lable3.pack( side = LEFT)
description = Entry(bottomframe, bd =5)
description.pack(side = RIGHT)
Lable4 = Label(lastframe, text="Enter Your Keyword! ", font='Source_Sans_Pro 11')
Lable4.pack( side = LEFT)
keyword = Entry(lastframe, bd =5)
keyword.pack(side = RIGHT)
Lable5 = Label(one, text="Enter Your Post Url! ", font='Source_Sans_Pro 11')
Lable5.pack( side = LEFT)
post_url = Entry(one, bd =5)
post_url.pack(side = RIGHT)
Button_Start = Button(last, text="Start", fg="black", width=50, command=all)
Button_Start.pack( side = BOTTOM)
pg.FAILSAFE = True
#this is hidden def
def all():
print("Done")
window.mainloop()
错误!
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\User`enter code here`s\Hamza Lachi\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
TypeError: all() takes exactly one argument (0 given)
【问题讨论】: