def run(self, app): title = "celestine - PyPI" dpg.create_context() dpg.create_viewport(title=title, small_icon="celestine_small.ico", large_icon="celestine_large.ico", width=1920, height=1080, x_pos=256, y_pos=256, min_width=640, max_width=3840, min_height=480, max_height=2160, resizable=True, vsync=True, always_on_top=False, decorated=True, clear_color=(0, 0, 0)) with dpg.texture_registry(show=False): app.setup(self) with dpg.window(tag="primary_window"): app.view(self) dpg.setup_dearpygui() dpg.show_viewport(minimized=False, maximized=False) dpg.set_primary_window("primary_window", True) dpg.start_dearpygui() dpg.destroy_context()
def build(self): self.primary_window.build() # primary window dpg_id _primary_window_dpg_id = self.primary_window.dpg_id # set the things for primary window dpg.set_primary_window(window=_primary_window_dpg_id, value=True) # todo: have to figure out theme, font etc. # themes.set_theme(theme="Dark Grey") # assets.Font.RobotoRegular.set(item_dpg_id=_ret, size=16) dpg.bind_item_theme(item=_primary_window_dpg_id, theme=asset.Theme.DARK.get())
def set_primary_window(window: Optional[Window]) -> None: """Set a window as the primary window, or remove the primary window. When a window is set as the primary window it will fill the entire viewport. If any other window was already set as the primary window, it will be unset. """ if window is not None: dpgcore.set_primary_window(window.id, True) else: dpgcore.set_primary_window('', False)
def show(self): dpg.create_context() dpg.create_viewport( title="MQTT Message Chat (me: " + self.data.myself + ")", width=MAIN_WINDOW_WIDTH, height=MAIN_WINDOW_HEIGHT, ) dpg.setup_dearpygui() self._show_gui() dpg.show_viewport() dpg.set_primary_window(PRIMARY_WINDOW, True) while dpg.is_dearpygui_running(): self.main_callback() dpg.render_dearpygui_frame() dpg.destroy_context()
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()
dpg.add_theme_color(dpg.mvThemeCol_Button, colour, category=dpg.mvThemeCat_Core) dpg.add_theme_style(dpg.mvStyleVar_FrameRounding, 5, category=dpg.mvThemeCat_Core) dpg.bind_item_theme(button, theme_id) return node_selector dpg.create_context() dpg.create_viewport(title='Heron', width=1700, height=1000, x_pos=350, y_pos=0) 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)
self.show_status("Text succesfult krypteret og gemt", True) # Fortæller brugeren om det var succesfult dpg.set_value(self.writePW, "") # Tømmer brugerens inputfelt og lukker skrivevinduet dpg.hide_item(self.writeWindow) def read_text(self): # Bruger decrypt funktionen til at forsøge at dekryptere fileName.txt filen password = dpg.get_value(self.readPW) if self.decrypt(password): # Tjekker om dekryptering virkede with open(self.fileName, "r") as f: # Åbner dekryptet fil dpg.set_value(self.rwfield, f.read()) # Viser indholdet til brugeren self.delete_txt( ) # Sletter dekrypteret fil, så indholdet forbliver hemmeligt self.show_status("Fil dekrypteret succesfult!", True) dpg.set_value(self.readPW, "") # Tømmer inputfelt og lukker læsevinduets dpg.hide_item(self.readWindow) if __name__ == '__main__': # Koden kører ikke, hvis importeret. w = WordSaver() # Opretter WordSaver objekt view = prep_vp(width, height) # Forbereder viewport dpg.setup_dearpygui(viewport=view) dpg.set_primary_window(w.mainWindow, True) # Sætter hovedvinduet som hovedvindue dpg.show_viewport(view) dpg.start_dearpygui() # Starter brugerfladen
import dearpygui.dearpygui as dpg dpg.create_context() dpg.create_viewport() dpg.setup_dearpygui() with dpg.window(tag='main'): dpg.add_progress_bar(label='Progress Bar', tag='progress_bar') dpg.set_primary_window('main', True) dpg.show_viewport() while dpg.is_dearpygui_running(): dpg.set_value('progress_bar', dpg.get_value('progress_bar') + .001) dpg.render_dearpygui_frame() dpg.destroy_context()
def __init__(self, parent=None): self.DataPath = None self.DataStartDate = None self.StartDate = None self.WindowPositionX = None self.WindowPositionY = None self.nBeginYear = 2019 self.nBeginMonth = 1 self.nBeginDay = 1 self.nEndYear = 1970 self.nEndMonth = 1 self.nEndDay = 1 self.LoadInitFile() self.ExecuteTime = time.localtime() # TimeStr = str(self.ExecuteTime.tm_year) + "-" + str(self.ExecuteTime.tm_mon).zfill(2) + "-" + str(self.ExecuteTime.tm_mday).zfill( # 2) + " " + str(self.ExecuteTime.tm_hour).zfill(2) + ":" + str(self.ExecuteTime.tm_min).zfill(2) + ":" + str( # self.ExecuteTime.tm_sec).zfill(2) #================= UI =================. self.count = 0 if parent: self.window_id = parent else: self.window_id = dpg.add_window(label="MyApp") # print(self.window_id) dpg.set_primary_window(self.window_id, True) # window_id = dpg.window(label="MyApp") if not dpg.is_viewport_created(): vp = dpg.create_viewport(title="MyApp", width=430, height=750, x_pos=int(self.WindowPositionX), y_pos=int(self.WindowPositionY)) dpg.setup_dearpygui(viewport=vp) dpg.show_viewport(vp) dpg.set_viewport_height(950) dpg.set_viewport_width(950) # self.slider_float = dpg.add_slider_float(label="float", parent=self.window_id, width=100) # self.ID_GetWinSize = dpg.add_button(parent=self.window_id, label="GetWinSize", callback=self.callback_getwinsize ) # dpg.add_same_line(parent=self.window_id) dpg.add_text(parent=self.window_id, default_value="Time:") dpg.add_same_line(parent=self.window_id) self.ID_TimeText = dpg.add_button(parent=self.window_id, label="0", callback=self.callback_update_enddate) self.ID_BtnBeginDate = 0 self.ID_BeginDate = None self.ID_BeginDatePicker= None self.ID_BeginYear = None self.ID_BeginMonth = None self.ID_BeginDay = None self.ID_BtnEndDate = 0 self.ID_EndDate = None self.ID_EndDatePicker = None self.ID_EndYear = None self.ID_EndMonth = None self.ID_EndDay = None self.ShowInfo() self.UIBeginDate() self.UIEndDate() # dpg.add_same_line(parent=self.window_id) # self.ID_BeginDate = dpg.add_button(label="BeginDate", parent=self.window_id, callback=self.callback_begindate) self.BeginDate = datetime.strptime(self.StartDate, "%Y-%m-%d") self.EndDate = datetime.today() self.Stock = StockTool(self.DataPath, self.BeginDate, self.EndDate) self.ID_BtnDownloadData = dpg.add_button(parent=self.window_id, label="Download", callback=self.callback_downloaddata)