DearPyGui
DearPyGui copied to clipboard
Drag Rects demo in dpg.demo does not work, this is expected?
I used dpg 2.0.0
A demo seems broken.
In the pic below, I guess the red area in the upper plot is supposed to be plotted in the lower plot. But apparently the two plots are completely independent. This is expected?
I think it need to use drag_rect's callback instead of plot's callback.
with dpg.tree_node(label="Drag Rects"):
def drag_query(sender, app_data, user_data):
# FIXME: app_data always None ?
x1, y1, x2, y2 = dpg.get_value(sender)
dpg.set_axis_limits(user_data[0], x1, x2)
dpg.set_axis_limits(user_data[1], y1, y2)
with dpg.plot(label="Drag Rects", height=400, width=-1):
dpg.add_plot_axis(dpg.mvXAxis, label="x")
with dpg.plot_axis(dpg.mvYAxis, label="y"):
dpg.add_line_series(sindatax, sindatay)
# drag rects belong to the plot NOT axis
drag_rect_1 = dpg.add_drag_rect(label="drag rect 1", color=[255, 0, 0, 255], default_value=(0, 1, 1, 0), callback=drag_query)
with dpg.plot(no_title=True, height=400, no_menus=True, width=-1, tag="drag_plot2"):
xaxis_drag2 = dpg.add_plot_axis(dpg.mvXAxis, label="x")
yaxis_drag2 = dpg.add_plot_axis(dpg.mvYAxis, label="y")
dpg.add_line_series(sindatax, sindatay, parent=yaxis_drag2)
# set drag_rect_1 user data to axis so the query callback has access
dpg.configure_item(drag_rect_1, user_data=(xaxis_drag2, yaxis_drag2))