def popup(parent: int, mousebutton: int = internal_dpg.mvMouseButton_Right, modal: bool = False) -> int: try: _internal_popup_id = internal_dpg.generate_uuid() internal_dpg.add_clicked_handler( parent, mousebutton, callback=lambda: internal_dpg.configure_item(_internal_popup_id, show=True)) if modal: internal_dpg.add_window(modal=True, show=False, id=_internal_popup_id, autosize=True) else: internal_dpg.add_window(popup=True, show=False, id=_internal_popup_id, autosize=True) internal_dpg.push_container_stack(internal_dpg.last_container()) yield _internal_popup_id finally: internal_dpg.pop_container_stack()
def file_callback(sender, data): nonlocal c_board nonlocal pars pars = Parser() pars.get_plays(data[0]+'/'+data[1]) # Lista de partidas cargadas--------------------------------TODO dpg.add_window('Lista de Partidas',on_close=close_callback) colums = set() for match in pars.matches: for att in match.attr: colums.add(att) colums = list(colums) # colums.sort() dpg.add_table("Partidas", colums, callback=load_match) rows = list() for match in pars.matches: row = list() for colum in colums: row.append(match.attr[colum]) rows.append(row) for row in rows: dpg.add_row("Partidas", row) dpg.end()
def pick_maple_window(self, sender, data): def callback_on_picking_window(sender, data): self.window_title = sender self.send_to_pipes(f'WINDOW\\{sender}') set_value('Currently doing nothing. Pick MapleStory window.', f'Will work on {sender} window') delete_item('Pick Maple Window##1') def callback_on_refresh(sender, data): delete_item('Pick Maple Window##1') self.pick_maple_window(None, None) add_window("Pick Maple Window##1") add_text("Please make sure that your MapleStory") add_text("window is open. If your MapleStory") add_text("window is closed, click on refresh button") add_text("after opening your MapleStory window.") add_button('Refresh the windows', callback=callback_on_refresh) add_spacing(count=6) titles = get_active_windows() if len(titles) == 0: add_text('No active MapleStory windows') else: add_text('Please select one:') for window_title in titles: add_button(window_title, callback=callback_on_picking_window) end()
def window(*args, width: int = 200, height: int = 200, autosize: bool = False, no_resize: bool = False, no_title_bar: bool = False, no_move: bool = False, no_scrollbar: bool = False, no_collapse: bool = False, horizontal_scrollbar: bool = False, no_focus_on_appearing: bool = False, no_bring_to_front_on_focus: bool = False, menubar: bool = False, no_close: bool = False, no_background: bool = False, label: str = "__DearPyGuiDefault", show: bool = True, collapsed: bool = False, on_close: Callable = None, min_size: List[int]=[32, 32], max_size: List[int] = [30000, 30000], id:str=''): """Wraps add_window() and automates calling end(). Args: name: Unique name used to programmatically refer to the item. If label is unused this will be the label, anything after "##" that occurs in the name will not be shown on screen. **width: Width of the item. **height: Height of the item. **autosize: Autosized the window to fit it's items. **no_resize: Allows for the window size to be changed or fixed **no_title_bar: Title name for the title bar of the window **no_move: Allows for the window's position to be changed or fixed **no_scrollbar: Disable scrollbars (window can still scroll with mouse or programmatically) **no_collapse: Disable user collapsing window by double-clicking on it **horizontal_scrollbar: Allow horizontal scrollbar to appear (off by default). **no_focus_on_appearing: Disable taking focus when transitioning from hidden to visible state **no_bring_to_front_on_focus: Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus) **menubar: Decides if the menubar is shown or not. **no_close: Decides if the window can be closed. **no_background: **label: Displayed name of the item. **show: sets if the item is shown or not window. **on_close: Callback ran when window is closed **min_size: Minimum window size **max_size: Maximum window size Returns: None """ try: if label == "__DearPyGuiDefault": yield internal_dpg.add_window(*args, width=width, height=height, autosize=autosize, no_resize=no_resize, no_title_bar=no_title_bar, no_move=no_move, no_scrollbar=no_scrollbar, no_collapse=no_collapse, horizontal_scrollbar=horizontal_scrollbar, no_focus_on_appearing=no_focus_on_appearing, no_bring_to_front_on_focus=no_bring_to_front_on_focus, menubar=menubar, no_close=no_close, no_background=no_background, show=show, collapsed=collapsed, on_close=on_close, min_size=min_size, max_size=max_size, id=id) else: yield internal_dpg.add_window(*args, width=width, height=height, autosize=autosize, no_resize=no_resize, no_title_bar=no_title_bar, no_move=no_move, no_scrollbar=no_scrollbar, no_collapse=no_collapse, horizontal_scrollbar=horizontal_scrollbar, no_focus_on_appearing=no_focus_on_appearing, no_bring_to_front_on_focus=no_bring_to_front_on_focus, menubar=menubar, no_close=no_close, no_background=no_background, label=label, show=show, collapsed=collapsed, on_close=on_close, min_size=min_size, max_size=max_size, id=id) finally: internal_dpg.end()
def window(name: str, width: int = -1, height: int = -1, x_pos: int = 200, y_pos: int = 200, autosize: bool = False, no_resize: bool = False, no_title_bar: bool = False, no_move: bool = False, show: bool = True, on_close: Callable = None): try: yield dpg.add_window(name, width=width, height=height, x_pos=x_pos, y_pos=y_pos, autosize=autosize, no_resize=no_resize, no_title_bar=no_title_bar, no_move=no_move, show=show, on_close=on_close) finally: dpg.end()
def __init__(self): core.set_style_item_spacing(1, 1) core.set_style_window_padding(0, 0) core.enable_docking(shift_only=False, dock_space=True) core.set_main_window_size(690, 450) root = os.path.dirname(__file__) self.__configFile = f'{root}/config.json' with simple.window("main"): with simple.group("test", width=200): core.add_button("button1") core.add_window() with simple.window("floaty", ): with simple.group("test", width=200): core.add_button("button1") core.set_exit_callback(self.__exit) self.__configLoad()
def window(name: str, width: int = 500, height: int = 500, x_pos: int = 200, y_pos: int = 200, autosize: bool = False, no_resize: bool = False, no_title_bar: bool = False, no_move: bool = False, label: str = "__DearPyGuiDefault", show: bool = True, on_close: Callable = None): try: if label == "__DearPyGuiDefault": yield internalDPG.add_window(name, width=width, height=height, x_pos=x_pos, y_pos=y_pos, autosize=autosize, no_resize=no_resize, no_title_bar=no_title_bar, no_move=no_move, show=show, on_close=on_close) else: yield internalDPG.add_window(name, width=width, height=height, x_pos=x_pos, y_pos=y_pos, autosize=autosize, no_resize=no_resize, no_title_bar=no_title_bar, no_move=no_move, label=label, show=show, on_close=on_close) finally: internalDPG.end()
def __init__(self): self.log_level = 0 self._auto_scroll = True self.filter_id = None self.window_id = dpg.add_window(label="mvLogger") self.count = 0 self.flush_count = 1000 with cxt.group(horizontal=True, parent=self.window_id): dpg.add_checkbox(label="Auto-scroll", default_value=True, callback=lambda sender: self.auto_scroll( dpg.get_value(sender))) dpg.add_button(label="Clear", callback=lambda: dpg.delete_item( self.filter_id, children_only=True)) dpg.add_input_text(label="Filter", callback=lambda sender: dpg.set_value( self.filter_id, dpg.get_value(sender)), parent=self.window_id) self.child_id = dpg.add_child(parent=self.window_id, autosize_x=True, autosize_y=True) self.filter_id = dpg.add_filter_set(parent=self.child_id) with cxt.theme() as self.trace_theme: dpg.add_theme_color(dpg.mvThemeCol_Text, (0, 255, 0, 255)) with cxt.theme() as self.debug_theme: dpg.add_theme_color(dpg.mvThemeCol_Text, (64, 128, 255, 255)) with cxt.theme() as self.info_theme: dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 255, 255, 255)) with cxt.theme() as self.warning_theme: dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 255, 0, 255)) with cxt.theme() as self.error_theme: dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255)) with cxt.theme() as self.critical_theme: dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255))
def _setup_add_widget(self, dpg_args) -> None: dpgcore.add_window(self.id, on_close=self._on_close, **dpg_args)
def window(name: str, width: int = 200, height: int = 200, x_pos: int = 200, y_pos: int = 200, autosize: bool = False, no_resize: bool = False, no_title_bar: bool = False, no_move: bool = False, no_scrollbar: bool = False, no_collapse: bool = False, horizontal_scrollbar: bool = False, no_focus_on_appearing: bool = False, no_bring_to_front_on_focus: bool = False, menubar: bool = False, no_close: bool = False, no_background: bool = False, label: str = "__DearPyGuiDefault", show: bool = True, on_close: Callable = None): """Wraps add_window() and automates calling end(). Args: name: Unique name used to programmatically refer to the item. If label is unused this will be the label, anything after "##" that occurs in the name will not be shown on screen. width: Width of the item. height: Height of the item. x_pos: x position the window will start at y_pos: y position the window will start at autosize: Autosized the window to fit it's items. no_resize: Allows for the window size to be changed or fixed no_title_bar: Title name for the title bar of the window no_move: Allows for the window's position to be changed or fixed no_scrollbar: Disable scrollbars (window can still scroll with mouse or programmatically) no_collapse: Disable user collapsing window by double-clicking on it horizontal_scrollbar: Allow horizontal scrollbar to appear (off by default). no_focus_on_appearing: Disable taking focus when transitioning from hidden to visible state no_bring_to_front_on_focus: Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus) menubar: Decides if the menubar is shown or not. no_close: Decides if the window can be closed. no_background: label: Displayed name of the item. show: sets if the item is shown or not window. on_close: Callback ran when window is closed Returns: None """ try: if label == "__DearPyGuiDefault": yield internal_dpg.add_window( name, width=width, height=height, x_pos=x_pos, y_pos=y_pos, autosize=autosize, no_resize=no_resize, no_title_bar=no_title_bar, no_move=no_move, no_scrollbar=no_scrollbar, no_collapse=no_collapse, horizontal_scrollbar=horizontal_scrollbar, no_focus_on_appearing=no_focus_on_appearing, no_bring_to_front_on_focus=no_bring_to_front_on_focus, menubar=menubar, no_close=no_close, no_background=no_background, show=show, on_close=on_close) else: yield internal_dpg.add_window( name, width=width, height=height, x_pos=x_pos, y_pos=y_pos, autosize=autosize, no_resize=no_resize, no_title_bar=no_title_bar, no_move=no_move, no_scrollbar=no_scrollbar, no_collapse=no_collapse, horizontal_scrollbar=horizontal_scrollbar, no_focus_on_appearing=no_focus_on_appearing, no_bring_to_front_on_focus=no_bring_to_front_on_focus, menubar=menubar, no_close=no_close, no_background=no_background, label=label, show=show, on_close=on_close) finally: internal_dpg.end()
def window(name: str, width: int = 200, height: int = 200, x_pos: int = 200, y_pos: int = 200, autosize: bool = False, no_resize: bool = False, no_title_bar: bool = False, no_move: bool = False, no_scrollbar: bool = False, no_collapse: bool = False, horizontal_scrollbar: bool = False, no_focus_on_appearing: bool = False, no_bring_to_front_on_focus: bool = False, menubar: bool = False, no_close: bool = False, no_background: bool = False, label: str = "__DearPyGuiDefault", show: bool = True, on_close: Callable = None): try: if label == "__DearPyGuiDefault": yield internalDPG.add_window( name, width=width, height=height, x_pos=x_pos, y_pos=y_pos, autosize=autosize, no_resize=no_resize, no_title_bar=no_title_bar, no_move=no_move, no_scrollbar=no_scrollbar, no_collapse=no_collapse, horizontal_scrollbar=horizontal_scrollbar, no_focus_on_appearing=no_focus_on_appearing, no_bring_to_front_on_focus=no_bring_to_front_on_focus, menubar=menubar, no_close=no_close, no_background=no_background, show=show, on_close=on_close) else: yield internalDPG.add_window( name, width=width, height=height, x_pos=x_pos, y_pos=y_pos, autosize=autosize, no_resize=no_resize, no_title_bar=no_title_bar, no_move=no_move, no_scrollbar=no_scrollbar, no_collapse=no_collapse, horizontal_scrollbar=horizontal_scrollbar, no_focus_on_appearing=no_focus_on_appearing, no_bring_to_front_on_focus=no_bring_to_front_on_focus, menubar=menubar, no_close=no_close, no_background=no_background, label=label, show=show, on_close=on_close) finally: internalDPG.end()