-
-
Notifications
You must be signed in to change notification settings - Fork 767
Open
Labels
Description
Version of Dear PyGui
Version: 2.1.0
Operating System: Windows 11
My Issue/Question
While using add_scatter_series with references to a numpy ndarray (see code below) an exception is raised. This can be avoided by copying the relevant data before or creating a list.
Exception has occurred: SystemError returned a result with an exception set
File "...", line 32, in
dpg.add_scatter_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis", tag="series_tag")
SystemError: returned a result with an exception set
Is it the expected behavior that an exception is raised here?
To Reproduce
Run the script below.
Expected behavior
add_scatter_plot should work when references to ndarrays are used.
Standalone, minimal, complete and verifiable example
import dearpygui.dearpygui as dpg
from math import sin
import numpy as np
dpg.create_context()
sindata = np.zeros((500,2))
for i in range(0, 500):
sindata[i,0] = i / 1000
sindata[i,1] = 0.5 + 0.5 * sin(50 * i / 1000)
with dpg.window(label="Tutorial", tag="win"):
with dpg.plot(label="Line Series", height=400, width=400):
dpg.add_plot_axis(dpg.mvXAxis, label="x")
dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis")
sindatax = sindata[:,0]
sindatay = sindata[:,1]
# === WORKAROUND / FIX No. 1 ===
#sindatax = np.copy(sindata[:,0])
#sindatay = np.copy(sindata[:,1])
# === WORKAROUND / FIX No. 2 ===
#sindatax = sindata[:,0].tolist()
#sindatay = sindata[:,1].tolist()
# Crashes here
dpg.add_scatter_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis", tag="series_tag")
dpg.create_viewport(title='Custom Title', width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()