|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
这段代码和小鱼书上的一样没为什么会有报错呢?实在找不出原因,亲老师们看看吧,谢谢啦!!
import tkinter as tk
class App:
def __int__(self, root):
frame = tk.Frame(root)
frame.pack()
self.hi_there = tk.Button(frame, text="打招呼", fg="blue", command=self.say_hi)
self.hi_there.pack(side=tk.LEFT)
def say_hi(self):
print("大家好,我是渣渣辉")
root = tk.Tk()
print(type(root))
app = App(root)
root.mainloop()
C:\Users\liaofz\anaconda3\python.exe C:/mypython/study/tkinter界面/tk3.pyTraceback (most recent call last): File "C:/mypython/study/tkinter界面/tk3.py", line 22, in <module> app = App(root)TypeError: App() takes no arguments
本帖最后由 Daniel_Zhang 于 2020-12-31 15:17 编辑
__int__是个啥玩意......
想必你用的不是 vscode,vscode在 __int__那儿一直显示红色标线
如果该答案对您有帮助,请设置为最佳答案,谢谢!找不同着实费眼睛~
|
|