这是设置背景的代码:
'''
Background picture:
'''
background_image=tk.PhotoImage("blood_PNG6140.png")
background_label = tk.Label(parent, image=background_image)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
我遇到此错误:
Traceback (most recent call last):
File "/Users/Lana/Desktop/Zaid/End_Projekt_MakE_YouR_ChoicE_zaid_zaim ON MAC/MakeYourChoice.py", line 275, in <module>
background_image=tk.PhotoImage("blood_PNG6140.png")
NameError: name 'tk' is not defined
>>>
先谢谢您! ZZaim
答案 0 :(得分:0)
您忘记导入tkinter
。地方
import tkinter as tk
.py文件的标题中。
答案 1 :(得分:0)
将import tkinter as tk
添加到代码顶部