hoffstadt / DearPyGui

Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
https://dearpygui.readthedocs.io/en/latest/
MIT License
12.94k stars 676 forks source link

I cant display images on my window no matter what i do #2155

Open LukaEardley opened 1 year ago

LukaEardley commented 1 year ago

Im trying to display an image on my window and potentially use it as a background of sorts on my GUI, however, it doesnt seem to want to load or display the image and i get the following error.

SystemError: <built-in function pop_container_stack> returned a result with an exception set

Full Error report:

Traceback (most recent call last): File "c:\Users\luka\Desktop\Argonaut\poes.py", line 20, in <module> main() File "c:\Users\luka\Desktop\Argonaut\poes.py", line 5, in main with dpg.handler_registry(): File "C:\Users\luka\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) File "c:\Users\luka\Desktop\Argonaut\cheats-env\lib\site-packages\dearpygui\dearpygui.py", line 1971, in handler_registry internal_dpg.pop_container_stack() SystemError: <built-in function pop_container_stack> returned a result with an exception set

Heres the code im using:

`import dearpygui.dearpygui as dpg

def main(): dpg.create_context() with dpg.handler_registry(): dpg.setup_dearpygui()

    with dpg.window(label="Window with Background", width=500, height=200):
        image_path = r"C:\Users\luka\Desktop\Argonaut\IMGS\black.jpg"
        image_id = dpg.generate_uuid()
        dpg.load_image(image_path, parent=image_id)

        with dpg.texture_registry():
            dpg.add_image(image_id, width=800, height=600)

    dpg.setup_dearpygui()

dpg.destroy_context()

if name == "main": main()`

IvanNazaruk commented 1 year ago

https://dearpygui.readthedocs.io/en/latest/documentation/textures.html#loading-images