aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dearpygui/test7_querying.py
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2021-11-11 19:21:33 +0100
committerNao Pross <np@0hm.ch>2021-11-11 19:21:33 +0100
commit0ad4b5f2b78e199dae017fdb6cb80fca39102e5a (patch)
tree9dfd95ba31d63441cf27444fd412498f745f136a /tests/dearpygui/test7_querying.py
parentAdd more references (diff)
downloadFading-0ad4b5f2b78e199dae017fdb6cb80fca39102e5a.tar.gz
Fading-0ad4b5f2b78e199dae017fdb6cb80fca39102e5a.zip
Rename sketch.py to gui.py, move tests in test/ directory
Diffstat (limited to 'tests/dearpygui/test7_querying.py')
-rw-r--r--tests/dearpygui/test7_querying.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/dearpygui/test7_querying.py b/tests/dearpygui/test7_querying.py
new file mode 100644
index 0000000..06f3ceb
--- /dev/null
+++ b/tests/dearpygui/test7_querying.py
@@ -0,0 +1,37 @@
+import dearpygui.dearpygui as dpg
+from math import sin
+
+dpg.create_context()
+
+sindatax = []
+sindatay = []
+for i in range(0, 100):
+ sindatax.append(i / 100)
+ sindatay.append(0.5 + 0.5 * sin(50 * i / 100))
+
+with dpg.window(label="Tutorial", width=400, height=600):
+ dpg.add_text("Click and drag the middle mouse button over the top plot!")
+
+
+ def query(sender, app_data, user_data):
+ dpg.set_axis_limits("xaxis_tag2", app_data[0], app_data[1])
+ dpg.set_axis_limits("yaxis_tag2", app_data[2], app_data[3])
+
+
+ # plot 1
+ with dpg.plot(no_title=True, height=200, callback=query, query=True, no_menus=True, width=-1):
+ dpg.add_plot_axis(dpg.mvXAxis, label="x")
+ dpg.add_plot_axis(dpg.mvYAxis, label="y")
+ dpg.add_line_series(sindatax, sindatay, parent=dpg.last_item())
+
+ # plot 2
+ with dpg.plot(no_title=True, height=200, no_menus=True, width=-1):
+ dpg.add_plot_axis(dpg.mvXAxis, label="x1", tag="xaxis_tag2")
+ dpg.add_plot_axis(dpg.mvYAxis, label="y1", tag="yaxis_tag2")
+ dpg.add_line_series(sindatax, sindatay, parent="yaxis_tag2")
+
+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