No module named 'dearpygui.core'

8.1k Views Asked by At

I am trying to run this code using Notepad++ version 8.14

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

#window object setting
set_main_window_size(540, 720)
set_global_font_scale(1.25)
set_theme("Gold")

with window("SMS SMS Spam Filter", width = 520, height = 667):
    print("GUI is runngin")
    
start_dearpygui()

but the output is error which is

    from dearpygui.core import *
ModuleNotFoundError: No module named 'dearpygui.core'

I have tried pip install dearpygui on command prompt, but it showed the same. Anyone can solve this?

2

There are 2 best solutions below

1
On BEST ANSWER

DearPyGui is under heavy devlopment and the code you are trying to run is the "old" way of doing things (prior to version 0.6). Here is the comparaison between an old and an up-to-date version of the library :

Old version

from dearpygui.core import *

def save_callback(sender, data):
    print("Save Clicked")

add_text("Hello, world")
add_button("Save", callback=save_callback)
add_input_text("string", default_value="Quick brown fox")
add_slider_float("float", default_value=0.273, max_value=1)

start_dearpygui()

New version

import dearpygui.dearpygui as dpg

def save_callback():
    print("Save Clicked")

with dpg.window(label="Example Window"):
    dpg.add_text("Hello, world")
    dpg.add_button(label="Save", callback=save_callback)
    dpg.add_input_text(label="string", default_value="Quick brown fox")
    dpg.add_slider_float(label="float", default_value=0.273, max_value=1)
dpg.start_dearpygui()

See the docs for more details.

0
On

I accidentally named my python file to dearpygui.py which gave the same error, not so strange if you think about it, but annoying.

Solution: Don't name your python file to dearpygui