【问题标题】:AttributeError: 'NoneType' object has no attribute 'configure'AttributeError:“NoneType”对象没有“配置”属性
【发布时间】:2022-07-08 21:57:52
【问题描述】:
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'

【问题讨论】:

    标签: python tkinter


    【解决方案1】:

    这应该可行。命令是label.config() 而不是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()
    

    【讨论】:

      猜你喜欢
      • 2019-01-01
      • 2021-12-26
      • 2019-07-23
      • 2018-05-13
      • 2020-09-07
      • 2017-05-03
      • 2023-03-16
      • 2018-07-14
      • 2013-06-16
      相关资源
      最近更新 更多