Cannot use DearPyGui function, like set_main_window_size, or add_drawing

1.6k Views Asked by At

I am usin DearPyGui to offload the work to my GPU. I want to create a simple window with a logo on it but I can't seem to find why it is not working. Here's the code :

from dearpygui.core import *
from dearpygui.simple import *

set_main_window_size(700, 700)
set_global_font_scale(1.25)
set_theme("Dark")
set_style_window_padding(30,30)

with window("Automated test", width = 640, height = 640):

    print ("Lancement des autotests")
    set_window_pos("Automated test", 0, 0)
    add_drawing("logo", width = 500, height = 500)

draw_image("logo", "Logo_company.png", [0, 240])


start_dearpygui()

For some reason, I get this error :

 File "/usr/local/lib/python3.7/dist-packages/dearpygui/simple.py", line 112, in menu_bar
    yield internal_dpg.add_menu_bar(name, show=show, parent=parent, before=before)

SystemError: <built-in function add_menu_bar> returned a result with an error set

Which is the same for any method from DearPyGui I try to summon after set_window_pos

Does anyone know what is wrong with what I wrote ?

1

There are 1 best solutions below

1
On

As I'm on the same path as you, i've found this answer : https://www.reddit.com/r/DearPyGui/comments/ml2xj9/this_is_my_first_time_using_dearpygui_also_a/

In substance :

There are four mandatory parameters to use in the draw_image command.

drawing : str
file : str
pmin : List[float]
pmax : List[float]

Pmin and pmax control from where to where the image is drawn.

You can find more info on this command here: https://hoffstadt.github.io/DearPyGui/api_core.html#dearpygui.core.draw_image

And :

example : raw_image('logo', 'logo_spamFilter.png', (0, 0),(458, 192))