From 0ad4b5f2b78e199dae017fdb6cb80fca39102e5a Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 11 Nov 2021 19:21:33 +0100 Subject: Rename sketch.py to gui.py, move tests in test/ directory --- tests/dearpygui/test2_axis_limis.py | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/dearpygui/test2_axis_limis.py (limited to 'tests/dearpygui/test2_axis_limis.py') diff --git a/tests/dearpygui/test2_axis_limis.py b/tests/dearpygui/test2_axis_limis.py new file mode 100644 index 0000000..bdfeda1 --- /dev/null +++ b/tests/dearpygui/test2_axis_limis.py @@ -0,0 +1,40 @@ +import dearpygui.dearpygui as dpg +from math import sin, cos + +dpg.create_context() + +sindatax = [] +sindatay = [] +for i in range(0, 500): + sindatax.append(i / 1000) + sindatay.append(0.5 + 0.5 * sin(50 * i / 1000)) + +def update_series(): + + cosdatax = [] + cosdatay = [] + for i in range(0, 500): + cosdatax.append(i / 1000) + cosdatay.append(0.5 + 0.5 * cos(50 * i / 1000)) + dpg.set_value('series_tag', [cosdatax, cosdatay]) + dpg.set_item_label('series_tag', "0.5 + 0.5 * cos(x)") + +with dpg.window(label="Tutorial", tag="win"): + dpg.add_button(label="Update Series", callback=update_series) + # create plot + with dpg.plot(label="Line Series", height=400, width=400): + # optionally create legend + dpg.add_plot_legend() + + # REQUIRED: create x and y axes + dpg.add_plot_axis(dpg.mvXAxis, label="x") + dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis") + + # series belong to a y axis + dpg.add_line_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() -- cgit v1.2.1