aboutsummaryrefslogtreecommitdiffstats
path: root/src/Test_Plots/test6_drag_points_and_lines.py
diff options
context:
space:
mode:
authorsara <sara.halter@gmx.ch>2021-11-06 20:11:11 +0100
committersara <sara.halter@gmx.ch>2021-11-06 20:11:11 +0100
commit9194b5e9e4d7b72bf08d01c0fde6ff78be36215e (patch)
tree0e5bcd30ed089c0674166cbcb995ca955e7ee88b /src/Test_Plots/test6_drag_points_and_lines.py
parentAn scr gearbeitet (diff)
downloadFading-9194b5e9e4d7b72bf08d01c0fde6ff78be36215e.tar.gz
Fading-9194b5e9e4d7b72bf08d01c0fde6ff78be36215e.zip
An graphischer Darstellung weitergearbeitet
Diffstat (limited to 'src/Test_Plots/test6_drag_points_and_lines.py')
-rw-r--r--src/Test_Plots/test6_drag_points_and_lines.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Test_Plots/test6_drag_points_and_lines.py b/src/Test_Plots/test6_drag_points_and_lines.py
new file mode 100644
index 0000000..c6d8862
--- /dev/null
+++ b/src/Test_Plots/test6_drag_points_and_lines.py
@@ -0,0 +1,26 @@
+import dearpygui.dearpygui as dpg
+
+dpg.create_context()
+
+def print_val(sender):
+ print(dpg.get_value(sender))
+
+with dpg.window(label="Tutorial", width=400, height=400):
+ with dpg.plot(label="Drag Lines/Points", height=-1, width=-1):
+ dpg.add_plot_legend()
+ dpg.add_plot_axis(dpg.mvXAxis, label="x")
+ dpg.set_axis_limits(dpg.last_item(), -5, 5)
+ dpg.add_plot_axis(dpg.mvYAxis, label="y")
+ dpg.set_axis_limits(dpg.last_item(), -5, 5)
+
+ # drag lines/points belong to the plot NOT axis
+ dpg.add_drag_line(label="dline1", color=[255, 0, 0, 255], default_value=2.0, callback=print_val)
+ dpg.add_drag_line(label="dline2", color=[255, 255, 0, 255], vertical=False, default_value=-2, callback=print_val)
+ dpg.add_drag_point(label="dpoint1", color=[255, 0, 255, 255], default_value=(1.0, 1.0), callback=print_val)
+ dpg.add_drag_point(label="dpoint2", color=[255, 0, 255, 255], default_value=(-1.0, 1.0), callback=print_val)
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context() \ No newline at end of file