不要寻找一些奇怪的词:)当我运行程序并输入 1 然后我输入电影并按下按钮我得到 NameError: global name 'film' is not defined 错误:(
from tkinter import *
anaform=Tk()
anaform.resizable(False, False)
def verial():
veri = giris.get()
veri2=giris.get()
veritabani = open(r"C:\Users\PC\Desktop\veritabani.txt", "a+")
if veri == "1":
giris.pack_forget()
giris2.pack()
veri2["text"] = film
veritabani.write(film + "\n")
elif veri == "2":
etiket2.config(text="Yours films:",font=("Flux", 24, "bold"),fg="red")
araetiket.config(text="_________________________",font=("Flux", 24, "bold"),fg="red")
veritabani.seek(0)
etiket3.config(text=veritabani.read(),font=("Corbal", 12))
etiket=Label(text="Make your selection: ", font=(24))
etiket.pack()
giris=Entry()
giris.pack()
giris2=Entry()
giris2.pack()
buton=Button(text="Gir!", command=verial, font=(24))
buton.pack(expand="yes", anchor="center")
etiket2=Label(text="")
etiket2.pack()
araetiket=Label(text="")
araetiket.pack()
etiket3=Label()
etiket3.pack()
mainloop()
不要寻找一些奇怪的词:)当我运行程序并输入 1 然后我输入电影并按下按钮我得到 NameError: global name 'film' is not defined 错误:(