'NoneType'对象没有属性'grid'

时间:2019-11-06 19:11:21

标签: tkinter python-3.6

import tkinter as tk
screen = tk.Tk()
screen.title("gui")
label =tk.Label(gui, text = "All the best").pack()
l1 =tk.Label(screen,text = "Grass",font=("Arial",50)).pack()
l1.grid(column = 0,row = 0)
screen.mainloop()

此代码显示以下错误:

  

:l1.grid(column = 0,row = 0)AttributeError:'NoneType'对象没有属性'grid'`

如何解决此错误?

0 个答案:

没有答案