def start(self): dpg.setup_registries() dpg.setup_viewport() dpg.set_viewport_title("Simple Data Flow") node_editor = NodeEditor() with dpg.window() as main_window: with dpg.menu_bar(): with dpg.menu(label="Operations"): dpg.add_menu_item(label="Reset", callback=lambda: dpg.delete_item(node_editor.uuid, children_only=True)) with dpg.menu(label="Plugins"): for plugin in self.plugins: dpg.add_menu_item(label=plugin[0], callback=plugin[1]) with dpg.group(horizontal=True) as group: # left panel with dpg.group(id=self.left_panel): self.data_set_container.submit(self.left_panel) self.modifier_container.submit(self.left_panel) # center panel node_editor.submit(group) # right panel with dpg.group(id=self.right_panel): self.inspector_container.submit(self.right_panel) self.tool_container.submit(self.right_panel) dpg.set_primary_window(main_window, True) dpg.start_dearpygui()
def _node_editor(): dpg.add_separator(label='BOT') dpg.add_text('STRATEGY ALGORITHM') with dpg.node_editor(callback=_link_node, delink_callback=_delink_node, menubar=True, height=500) as node_editor_id: with dpg.menu_bar(): with dpg.menu(label='New'): dpg.add_menu_item(label='dealer', callback=lambda: nodes.add_dealer(node_editor_id, exchange)) dpg.add_menu_item(label='current price', callback=lambda: nodes.add_current_price(node_editor_id)) dpg.add_menu_item(label='symbol', callback=lambda: nodes.add_symbol(node_editor_id)) dpg.add_menu_item(label='historical period', callback=lambda: nodes.add_history(node_editor_id)) dpg.add_menu_item(label='rolling mean', callback=lambda: nodes.add_rolling_mean(node_editor_id)) dpg.add_menu_item(label='distance', callback=lambda: nodes.add_distance(node_editor_id)) dpg.add_menu_item(label='rlines', callback=lambda: nodes.add_rlines(node_editor_id)) nodes.add_symbol(node_editor_id) nodes.add_current_price(node_editor_id) nodes.add_history(node_editor_id) nodes.add_rlines(node_editor_id)
dpg.add_menu_item(label='symbol', callback=lambda: nodes.add_symbol(node_editor_id)) dpg.add_menu_item(label='historical period', callback=lambda: nodes.add_history(node_editor_id)) dpg.add_menu_item(label='rolling mean', callback=lambda: nodes.add_rolling_mean(node_editor_id)) dpg.add_menu_item(label='distance', callback=lambda: nodes.add_distance(node_editor_id)) dpg.add_menu_item(label='rlines', callback=lambda: nodes.add_rlines(node_editor_id)) nodes.add_symbol(node_editor_id) nodes.add_current_price(node_editor_id) nodes.add_history(node_editor_id) nodes.add_rlines(node_editor_id) with dpg.window(label='Main', no_title_bar=True): core.set_primary_window(dpg.last_item(), True) with dpg.menu_bar(): with dpg.menu(label="File"): dpg.add_menu_item(label="show dpg demo", callback=lambda: show_demo()) dpg.add_menu_item(label="show dpg doc", callback=lambda: dpg.show_documentation()) with dpg.group(): main_parent = dpg.last_item() # menu bar # main with dpg.group(horizontal=True): with dpg.child(label='column_0', width=150, height=500): _candle_indicators() with dpg.child(label='column_1', width=700, height=500, payload_type='main_window', drop_callback=_ticker_drop): window_data.main_window_title = dpg.add_text('Ticker: ') # dpg.add_button(label='Period') # with dpg.popup(dpg.last_item(), modal=True, mousebutton=dpg.mvMouseButton_Left) as modal_id: # period_start = ''
dpg.add_theme_style(dpg.mvStyleVar_FrameRounding, 25) dpg.add_theme_color(dpg.mvThemeCol_Button, color_2) dpg.add_theme_color(dpg.mvThemeCol_ButtonActive, color_4) dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, color_2) dpg.add_theme_color(dpg.mvThemeCol_Border, color_2) dpg.add_theme_color(dpg.mvThemeCol_FrameBg, color_2) dpg.add_theme_color(dpg.mvThemeCol_WindowBg, color_1) # dpg.add_theme_style(dpg.mvStyleVar_FramePadding, i*3, i*3) master_toggle = dpg.add_checkbox(label="Master") autoclicker_toggle = dpg.add_checkbox(label="Autoclicker") timer_toggle = dpg.add_checkbox(label="Timer") volume_up_button = dpg.add_button(label="Volume Up", callback=lambda: android.send_keycode(keycodes.AKEYCODE_VOLUME_UP)) volume_down_button = dpg.add_button(label="Volume Down", callback=lambda: android.send_keycode(keycodes.AKEYCODE_VOLUME_DOWN)) dpg.set_item_theme(window_id, theme) with dpg.menu(label="Tools"): dpg.add_menu_item(label="Show Metrics", callback=lambda:dpg.show_tool(dpg.mvTool_Metrics)) dpg.setup_viewport() cc = 0 while dpg.is_dearpygui_running(): # print(cc) cc = cc+1 video_stream() dpg.render_dearpygui_frame()
with dpg.font_registry(): # add font (set as default for entire app) default_font = dpg.add_font(os.path.join(heron_path, 'resources', 'fonts', 'SF-Pro-Rounded-Regular.ttf'), 18) with dpg.window(width=1700, height=1000, pos=[0, 0]) as main_window: dpg.set_primary_window(main_window, True) # The Start Graph button that starts all processes with dpg.group(horizontal=True): start_graph_button_id = dpg.add_button(label="Start Graph", callback=on_start_graph) end_graph_button_id = dpg.add_button(label="End Graph", callback=on_end_graph) update_control_graph_buttons(False) dpg.bind_font(default_font) with dpg.menu_bar(label='Menu Bar'): with dpg.menu(label='File'): dpg.add_menu_item(label='New', callback=clear_editor) dpg.add_menu_item(label='Save', callback=save_graph) dpg.add_menu_item(label='Load', callback=load_graph) with dpg.menu(label='Local Network') as menu: ssh_info_editor.set_parent_id(menu) dpg.add_menu_item(label='Edit IPs/ports', callback=ssh_info_editor.edit_ssh_info) with dpg.menu(label='Operations'): dpg.add_menu_item(label='Add new Operations Folder (as Symbolic Link from Existing Repo)', callback=add_new_symbolic_link_node_folder) dpg.add_menu_item(label='Download Operations from the Heron-Repositories page', callback=view_operations_repos) node_selector = create_node_selector_window()
def setUp(self): dpg.create_context() with dpg.window() as self.window_id: def testy(sender, app, user): print(f"Sender: {dpg.get_item_type(sender)} {sender}, App Data: {app}, User Data:{user}") # Menus with dpg.menu_bar() as menu_bar: dpg.add_menu_item(label="menu item", payload_type="str", drop_callback=testy) with dpg.menu(label="menu", payload_type="str", drop_callback=testy): dpg.add_menu_item(label="menu item") # basic with dpg.collapsing_header(label="basic") as basic: dpg.add_image(dpg.mvFontAtlas) dpg.add_image_button(dpg.mvFontAtlas) dpg.add_text("this is a text widget") dpg.add_checkbox(label="checkbox") dpg.add_button(label="button") dpg.add_input_float(label="input float") dpg.add_input_floatx(label="input floatx") dpg.add_drag_int(label="drag int") dpg.add_drag_intx(label="drag intx") dpg.add_input_text(label="input text") dpg.add_slider_float(label="slider float") dpg.add_slider_floatx(label="slider floatx") dpg.add_listbox(label="listbox") dpg.add_selectable(label="selectable") dpg.add_radio_button(["item 1", "item 2"],label="radio button") # color with dpg.collapsing_header(label="color") as color: with dpg.group() as color: dpg.add_color_button([255,0,0,255]) dpg.add_color_edit([255,0,0,255]) dpg.add_colormap_button(label="Colormap Button 1") dpg.add_color_picker((255, 0, 255, 255), label="Color Picker", width=200) dpg.add_colormap_slider(label="Colormap Slider 1", default_value=0.5, payload_type="str", drop_callback=testy) dpg.add_colormap_scale(label="Colormap Spectral", min_scale=-100, max_scale=150, payload_type="str", drop_callback=testy) # containers with dpg.collapsing_header(label="containers"): with dpg.group() as containers: with dpg.collapsing_header(): btn = dpg.add_button() with dpg.group(width=150): dpg.add_button() with dpg.tree_node(): dpg.add_button() with dpg.child_window(width=150, height=100, payload_type="str", drop_callback=testy): pass # tab stuff with dpg.collapsing_header(label="tab bars"): with dpg.tab_bar(): with dpg.tab(label="tab", payload_type="str", drop_callback=testy): pass dpg.add_tab_button(label="tab button", payload_type="str", drop_callback=testy, drag_callback=testy) with dpg.drag_payload(parent=dpg.last_item(), drop_data="dropped", drag_data="dragged", user_data="user data", payload_type="str"): dpg.add_text(dpg.get_item_type(dpg.last_item())) dpg.add_text(f"Item ID: {dpg.last_item()}") # custom with dpg.collapsing_header(label="custom"): with dpg.group() as custom: dpg.add_date_picker() dpg.add_knob_float() dpg.add_3d_slider() dpg.add_time_picker() dpg.add_loading_indicator(payload_type="str", drop_callback=testy) # misc with dpg.collapsing_header(label="misc"): with dpg.group() as misc: dpg.add_progress_bar(label="progress bar", default_value=.5) # node with dpg.collapsing_header(label="node"): with dpg.node_editor() as node: with dpg.node(pos=[20,20], draggable=False): pass with dpg.node(pos=[100,100], draggable=False): pass # plots with dpg.collapsing_header(label="plot") as plot: with dpg.plot(): dpg.add_plot_legend(payload_type="str", drop_callback=testy) dpg.add_plot_axis(dpg.mvXAxis, label="x", payload_type="str", drop_callback=testy) with dpg.plot_axis(dpg.mvYAxis, label="y", payload_type="str", drop_callback=testy): dpg.add_line_series([0,1,2,3,4,5], [0,1,2,3,4,5], label="data") self.test_bind_items = dpg.get_item_children(basic, slot=1) self.test_bind_items += dpg.get_item_children(color, slot=1) self.test_bind_items += dpg.get_item_children(containers, slot=1) self.test_bind_items += dpg.get_item_children(custom, slot=1) self.test_bind_items += dpg.get_item_children(misc, slot=1) self.test_bind_items += dpg.get_item_children(node, slot=1) self.test_bind_items += dpg.get_item_children(plot, slot=1) dpg.setup_dearpygui()
import dearpygui.dearpygui as dpg def print_me(sender): print(f"Menu Item: {sender}") with dpg.window(label="Tutorial"): with dpg.menu_bar(): with dpg.menu(label="File"): dpg.add_menu_item(label="Save", callback=print_me) dpg.add_menu_item(label="Save As", callback=print_me) with dpg.menu(label="Settings"): dpg.add_menu_item(label="Setting 1", callback=print_me) dpg.add_menu_item(label="Setting 2", callback=print_me) dpg.add_menu_item(label="Help", callback=print_me) with dpg.menu(label="Widget Items"): dpg.add_checkbox(label="Pick Me", callback=print_me) dpg.add_button(label="Press Me", callback=print_me) dpg.add_color_picker(label="Color Me", callback=print_me) dpg.start_dearpygui()
other_files.append(fname) dpg.configure_item(headers_id, items=header_files) dpg.configure_item(cpp_id, items=cpp_files) dpg.configure_item(other_id, items=other_files) dpg.show_item(all_files_id) #----------------------------------------------------------------------------- # User Interface #----------------------------------------------------------------------------- # main window with dpg.window(label="Main") as main_id: with dpg.menu_bar(): with dpg.menu(label="Settings"): dpg.add_menu_item(label="List Files", callback=lambda: dpg.show_item(all_files_id)) dpg.add_menu_item(label="Ignore Settings", callback=lambda: dpg.show_item(ignore_options_id)) with dpg.menu(label="Tools"): dpg.add_menu_item(label="Show About", callback=lambda:dpg.show_tool(dpg.mvTool_About)) dpg.add_menu_item(label="Show Metrics", callback=lambda:dpg.show_tool(dpg.mvTool_Metrics)) dpg.add_menu_item(label="Show Documentation", callback=lambda:dpg.show_tool(dpg.mvTool_Doc)) dpg.add_menu_item(label="Show Debug", callback=lambda:dpg.show_tool(dpg.mvTool_Debug)) dpg.add_menu_item(label="Show Item Registry", callback=lambda:dpg.show_tool(dpg.mvTool_ItemRegistry)) dpg.add_input_text(label="Root", default_value="C:\\dev\\DearPyGui\\DearPyGui\\", id=root_id) dpg.add_same_line() dpg.add_button(label="Initialize", callback=search_directory) dpg.add_node_editor(label="Editor", id=editor_id)