Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues loading "pyimage1" #2592

Open
yoboy1102 opened this issue Sep 25, 2024 · 0 comments
Open

Issues loading "pyimage1" #2592

yoboy1102 opened this issue Sep 25, 2024 · 0 comments

Comments

@yoboy1102
Copy link

yoboy1102 commented Sep 25, 2024

I have an Airline Project that was working perfectly untill randomly has stopped runneing and is showing errors,

  • python --3.12.6
  • pillow --10.4.0
  • customtkinter --5.2.2
import customtkinter as ctk
from customtkinter import *
from tkinter import *
from tkinter import messagebox
from PIL import Image, ImageTk
from pathlib import Path
from tkinter import Canvas
from tkinter import PhotoImage
from Homepage import HomePage
from TopMenu import TopMenu
from Departure import DepartuePage
from Spinbox import FloatSpinbox
from tkcalendar import Calendar

OUTPUT_PATH = Path(__file__).parent
ASSETS_PATH = OUTPUT_PATH / Path(r"c:\Users\Arubaaa\OneDrive\Desktop\DESKTOP\kama 2024\build\assets\frame0")

def relative_to_assets(path: str) -> Path:
    return ASSETS_PATH / Path(path)

web = ctk.CTk()
ctk.set_appearance_mode('light')
ctk.set_default_color_theme('dark-blue')
web.geometry("1880x1000")
web.configure(bg = "#FCFFDD")

canvas = Canvas(
    web,
    bg = "#FCFFDD",
    height = 1000,
    width = 1880,
    bd = 0,
    highlightthickness = 0,
    relief = "ridge"
)
canvas.place(x = 0, y = 0)
image_image_1 = PhotoImage(
    file=relative_to_assets("image_1.png"))
image_1 = canvas.create_image(
    940.0,
    500.0,
    image=image_image_1
)

#-----rest of the code is too big and irrevalent to the issue------#

web.mainloop()

This isnt the finished code but the code does stop working here,

Traceback (most recent call last):
  File "c:\Users\Arubaaa\OneDrive\Desktop\DESKTOP\kama 2024\Project\MAIN.py", line 40, in <module>
    image_1 = canvas.create_image(
              ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Arubaaa\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 2846, in create_image
    return self._create('image', args, kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Arubaaa\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 2832, in _create     
    return self.tk.getint(self.tk.call(
                          ^^^^^^^^^^^^^
_tkinter.TclError: image "pyimage1" doesn't exist

Here`s the Error, if I comment out image_1, the next image I get "pyimage2" doesnt exist

Note: the files I import, SpinBox, DeparturePage, TopMenu, etc are just other .py files, they work individually aswell

Any Idea what would help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant