Перед созданием поста я пытался решить свою проблему путем поиска и чтения ошибок других пользователей, когда дело дошло до того, что «pyimage1» не существует, и я не мог применить это к своему коду, чтобы он работал эффективно.
Я не слишком уверен, что еще можно попробовать в данный момент, чтобы получить эти кнопки несколько фотографий! Я прочитал множество потоков от других людей с той же проблемой, но я просто не могу заставить ее работать.
код ошибки:
Исключение в обратном вызове Tkinter Traceback ( последний последний вызов): Файл "C: \ Users \ korey \ AppData \ Local \ Programs \ Python \ Python38 \ lib \ tkinter__init __. py", строка 1883, в вызов , возврат self.fun c (* args) Файл "C: / Users / korey / PycharmProjects / test rental / gui test.py", строка 186, в car_menu_screen Button (text = "Coupe", высота = "15", ширина = "75", команда = login, image = coupephoto) .place (x = 420, y = 220) Файл "C: \ Users \ korey \ AppData \ Local \ Programs \ Python \ Python38 \ lib \ tkinter__init __. Py ", строка 2645, в init Виджет. init (self, master, 'button', cnf, kw) Файл" C: \ Users \ korey \ AppData \ Local \ Программы \ Python \ Python38 \ lib \ tkinter__init __. Py ", строка 2567, в init self.tk.call (_tkinter.TclError: изображение" pyimage1 "не существует
def car_menu_screen():
global car_menu
main_screen.destroy() # Closes the main screen (login or register)
car_menu = Tk()
car_menu.geometry("1920x1080") # Sets Window Size
car_menu.title("Vehicle Choice Menu") # Sets Window Title
Label(text="What Type Of Vehicle Would You Like to Rent?", bg="red", width="300", height="2",
font=("Arial Black", 13)).pack()
Label(text="").pack()
coupephoto = PhotoImage(file="coupe.png")
sedanphoto = PhotoImage(file="sedan.png")
suvphoto = PhotoImage(file="suv.png")
sportsphoto = PhotoImage(file="sports.png")
Button(text="Coupe", image=coupephoto, height="150", width="350", command=login).place(x=420, y=220)
Label(text="").pack()
Button(text="Sedan", image=sedanphoto, height="150", width="350", command=register).place(x=960, y=220)
Label(text="").pack()
Button(text="SUV", image=suvphoto, height="150", width="350", command=register).place(x=420, y=500)
Label(text="").pack()
Button(text="Sports", image=sportsphoto, height="150", width="350", command=register).place(x=960, y=500)