这是我的代码,我经常遇到属性错误,我不知道错误在哪里:
from tkinter import*
class Student:
def __init__(self,root):
self.root=root
self.root.title("Customer Management System")
self.root.geometry("1350x780+0+0")
title=Label(self,root,text="SUNBIRD TAILORS",font=("times new
roman",40,"bold"),bg="blue",fg="white")
title.pack(side=TOP)
root=Tk()
ob = Student(root)
root.mainloop()
错误如下所示: self.tk=master.tk 属性错误:“学生”对象没有属性“tk”
您正在使用
self
作为Label
的第一个参数。该参数必须是小部件,但Student
不是小部件。只需删除self
:相关问题 更多 >
编程相关推荐