-
|
Hi, can anyone give me a hint how to draw_* over a child window? I have a windows with some plots, child_windows etc. i need to put some additional information over the plot but it draws in a background( import dearpygui.dearpygui as dpg
dpg.create_context()
with dpg.window(tag="Primary Window"):
with dpg.draw_layer():
dpg.draw_circle((-0, -0), 25, color=(100, 255, 200, 255))
dpg.draw_circle((10, 10), 25, color=(100, 155, 200, 255))
with dpg.child_window(tag="tool_win_oscope", show=True, border=False):
with dpg.group(horizontal=False, label="sgrp"):
with dpg.child_window():
dpg.add_plot()
dpg.create_viewport()
dpg.set_primary_window("Primary Window", True)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.set_viewport_vsync(True)
dpg.start_dearpygui()
dpg.destroy_context() |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
|
First of all, place the drawing primitives into the child window that you want to draw on. Use a Now, gathering this all together... import dearpygui.dearpygui as dpg
dpg.create_context()
with dpg.window(tag="Primary Window"):
with dpg.child_window(tag="tool_win_oscope", show=True, border=False):
with dpg.group(horizontal=False, label="sgrp"):
with dpg.child_window():
dpg.add_plot()
with dpg.group(pos=(0, 0)):
with dpg.drawlist(200, 100):
with dpg.draw_layer():
dpg.draw_circle((-0, -0), 25, color=(100, 255, 200, 255))
dpg.draw_circle((10, 10), 25, color=(100, 155, 200, 255))
dpg.create_viewport()
dpg.set_primary_window("Primary Window", True)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.set_viewport_vsync(True)
dpg.start_dearpygui()
dpg.destroy_context() |
Beta Was this translation helpful? Give feedback.
-
|
ah.. now i cant get access to the plot - no pan and zoom, i guess drawlist is intercepting mouse events ( |
Beta Was this translation helpful? Give feedback.
-
|
You can make it exactly the width and height that you need. What are you going to render on top of the plot? |
Beta Was this translation helpful? Give feedback.




First of all, place the drawing primitives into the child window that you want to draw on. Use a
dpg.drawlistas a parent. Then, since you want to draw on top of the plot, you need to overlay two items. This can be done in multiple ways, the easiest is to specifyposon one of the the widgets. Your drawlist should go after the plot because the items are rendered in the order they are created (if they belong to the same slot). Also, for some reasonposondrawlistdidn't work for me, probably due to a bug. This can be circumvented by placing it into a group an specifyingposon that group.Now, gathering this all together...