Python, TypeError: APP() takes no arguments

import tkinter as tk

class APP():
    def _init_(self,master):
        frame = tk.Frame(master)
        frame.pack(side = tk.LEFT, padx = 10, pady = 10)

        self.hi_there = tk.Button(frame,text = "打招呼",
                                  bg = 'black',fg = 'white',command = self.say_hi)
        self.hi_there.pack()

    def say_hi(self):
        print("hello everyone")


root = tk.Tk()
app = APP(root)

root.mainloop()

报错信息如下:
Traceback (most recent call last):
File "D:/py/AboutExcel/Tkinter_4.py", line 17, in
app = APP(root)
TypeError: APP() takes no arguments

Process finished with exit code 1

查看全部
Daniel_daodou
稻兜
2019/03/26 09:37
  • python
  • 点赞
  • 收藏
  • 回答
    私信

1个回复