我正在关注一本名为“Python编程”的着名Python书,并且已经将这本书跟在了这封信上,直到在编程的中间我想测试我的标签,所以我试了一下。代码运行良好,但标签没有出现。请帮帮我。代码在下面。tkinter标签没有显示
import sys
import os
from tkinter import *
class Safe(Frame):
""" PS """
def __init__(self, master):
""" Initalize the frame """
super(Application, self).__init__(master)
self.grid()
self.create_widgets()
def create_widgets(self):
""" Create button , text, and entry widgets """
# Create instuction label
self.inst_label = Label(self, text = "Welcome")
self.inst_label.grid(row = 0, column = 0, columnspan = 2, sticky = W)
#main
root = Tk()
root.title("Password Safe")
root.geometry("500x400")
root.mainloop()
感谢,看起来好多了 – iLoveApples
任何人都可以回答我 – iLoveApples
你永远不会创建一个'安全'的实例。 –