我的标签不是';t显示Python Tkinter

我的标签不是';t显示Python Tkinter,python,tkinter,Python,Tkinter,这是我的代码,由于某种原因,当我添加任何其他内容超过开始按钮时,它不会显示在我的窗口中。有什么问题吗?您需要使用text1.pack()而不是text1.pack。有关pack()函数的说明,请参阅。text1.pack与text1.pack()不同。 from tkinter import * #Making the frame_____________ class Window(Frame): def __init__(self, master = None): F

这是我的代码,由于某种原因,当我添加任何其他内容超过开始按钮时,它不会显示在我的窗口中。有什么问题吗?

您需要使用
text1.pack()
而不是
text1.pack
。有关
pack()
函数的说明,请参阅。

text1.pack
text1.pack()
不同。
from tkinter import *
#Making the frame_____________
class Window(Frame):

    def __init__(self, master = None):
        Frame.__init__(self,master)

        self.master = master

        self.init_window()
#_____________________________
#Making the actual window
    def init_window(self):

        self.master.title("Ethics and similar topics quiz")#Title along the top of the window

        self.pack(fill=BOTH, expand=1)

        StartButton = Button(self, text="Start Quiz", fg = "Purple",  command=self.showtxt)

        StartButton.config(height = 4 , width = 25)

        StartButton.place(x=815, y=1)#Positions it

    def showtxt(self):
        text1 = Label(self, text= "What is the meaning of the word 'Ethical'?")
        text1.pack