我有以下代码。这样就可以创建一个对话框。你知道吗
import tkinter as tk
import tkinter.ttk as ttk
class Window(ttk.Frame):
def __init__(self, master=None):
super().__init__(master, padding=2) # Creates self.master
helloLabel = ttk.Label(self, text="Hello Tkinter!")
quitButton = ttk.Button(self, text="Quit", command=self.quit)
helloLabel.pack()
quitButton.pack()
self.pack()
#self.create_widgets()
#self.create_layout()
# def create_widgets(self):
# pass
# def create_layout(self):
# pass
application = tk.Tk()
application.title("Window")
Window(application)
application.mainloop()
为什么当我在上面的代码中取消注释下面两行时,代码会中断?你知道吗
def create_widgets(self):
pass
我在Windows7 64位上使用的是python 3.4 32位。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐