Frame(w, width = 427, height = 250, bg = '#272727').place(x = 0, y = 0)
label1 = Label(w, text = 'APP', fg = 'white', bg = '#272727').place(x = 0, y = 0)
label1.configure(font =("Game of Squids", 24,"bold"))
AttributeError: 'NoneType'对象没有属性'configure'
应该可以。
import tkinter as tk
w = tk.Tk()
tk.Frame(w, width = 427, height = 250, bg = '#272727').place(x = 0, y = 0)
label1 = tk.Label(w, text = 'APP', fg= 'white', bg = '#272727')
label1.place(x = 0, y = 0)
label1.config(font =("Game of Squids", 24,"bold"))
w.mainloop()
小心,.place()方法不会返回任何东西!
你应该这样编辑你的代码:
Frame(w, width = 427, height = 250, bg = '#272727').place(x = 0, y = 0)
label1 = Label(w, text = 'APP', fg = 'white', bg = '#272727')
label1.place(x = 0, y = 0)
label1.configure(font =("Game of Squids", 24,"bold"))