python tkinter窗口代码

#Tkinterdemo.py
import tkinter as tk
class Tkdemo(object):
    def __init__(self):
        self.root=tk.Tk()
        self.txt=tk.Text(self.root,width=30,height=10)
        self.txt.pack()
        self.button=tk.Button(self.root,text='Click me',command=self.sayhello)
        self.button.pack()
    def sayhello(self):
        self.txt.insert(tk.INSERT,"Hello,World!\n")
d=Tkdemo()
d.root.mainloop()