def managed_columns(name: str, columns: int, *, border: bool = True, show: bool = True, parent: str = "", before: str = ""): """Wraps add_managed_columns() 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. columns: The number of columns to be created. **border: Shows a border. **show: Decides if the item is shown of not. **parent: Parent this item will be added to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) Returns: None """ try: yield internal_dpg.add_managed_columns(name, columns, border=border, show=show, parent=parent, before=before) finally: internal_dpg.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 collapsing_header(*args, label: str = "__DearPyGuiDefault", show: bool = True, parent: str = "", before: str = "", closable: bool = False, default_open: bool = False, open_on_double_click: bool = False, open_on_arrow: bool = False, leaf: bool = False, bullet: bool = False): """Wraps add_collapsing_header() 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. **label: Displayed name of the item. **show: Decides if the item is shown of not. **parent: Parent to add this item to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) **closable: Decides if the header can be collapsed. **default_open: Decides if item is open by default. **open_on_double_click: Need double-click to open node. **open_on_arrow: Only open when clicking on the arrow part. **leaf: No collapsing, no arrow (use as a convenience for leaf nodes). **bullet: Display a bullet instead of arrow. Returns: None """ try: if label == "__DearPyGuiDefault": yield internal_dpg.add_collapsing_header( *args, show=show, parent=parent, before=before, closable=closable, default_open=default_open, open_on_double_click=open_on_double_click, open_on_arrow=open_on_arrow, leaf=leaf, bullet=bullet) else: yield internal_dpg.add_collapsing_header( *args, show=show, label=label, parent=parent, before=before, closable=closable, default_open=default_open, open_on_double_click=open_on_double_click, open_on_arrow=open_on_arrow, leaf=leaf, bullet=bullet) finally: internal_dpg.end()
def menu_bar(name: str, show: bool = True, parent: str = "", before: str = ""): try: yield internalDPG.add_menu_bar(name, show=show, parent=parent, before=before) finally: internalDPG.end()
def tab(name: str, *, closable: bool = False, label: str = "__DearPyGuiDefault", show: bool = True, tip: str = "", no_reorder: bool = False, leading: bool = False, trailing: bool = False, no_tooltip: bool = False, parent: str = "", before: str = ""): """Wraps add_tab() 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. **closable: creates a button on the tab that can hide the tab. **label: Displayed name of the item. **show: Decides if the item is shown of not. **no_reorder: Disable reordering this tab or having another tab cross over this tab **leading: Enforce the tab position to the left of the tab bar (after the tab list popup button) **trailing: Enforce the tab position to the right of the tab bar (before the scrolling buttons) **no_tooltip: Disable tooltip for the given tab **tip: Adds a simple tooltip. **parent: Parent to add this item to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) Returns: None """ try: if label == "__DearPyGuiDefault": yield internal_dpg.add_tab(name, closable=closable, show=show, tip=tip, parent=parent, before=before, no_reorder=no_reorder, leading=leading, trailing=trailing, no_tooltip=no_tooltip) else: yield internal_dpg.add_tab(name, closable=closable, label=label, show=show, tip=tip, parent=parent, before=before, no_reorder=no_reorder, leading=leading, trailing=trailing, no_tooltip=no_tooltip) finally: internal_dpg.end()
def init_windows(self, external_exec_command=None): """ Creates and arranges our windows for the kit """ self._logger_window() self._command_window(exec_command=external_exec_command) c.add_debug_window("Debugger", x_pos=0, y_pos=350, width=500) c.end() c.set_main_window_size(1000, 850) c.set_main_window_pos(x=280, y=0)
def table(*args, header_row: bool = True, width: int = 0, height: int = 0, inner_width: int = 0, show: bool = True, parent: str = "", before: str = "", resizable: bool = False, reorderable: bool = False, hideable: bool = False, sortable: bool = False, context_menu_in_body: bool = False, row_background: bool = False, borders_innerH: bool = False, borders_outerH: bool = False, borders_innerV: bool = False, borders_outerV: bool = False, policy: int = 0, no_host_extendX: bool = False, no_host_extendY: bool = False, no_keep_columns_visible: bool = False, precise_widths: bool = False, no_clip: bool = False, pad_outerX: bool = False, no_pad_outerX: bool = False, no_pad_innerX: bool = False, scrollX: bool = False, scrollY: bool = False, id:str=''): """Wraps add_table() 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. **header_row: show headers at the top of the columns **width: **height: **inner_width: **show: Attempt to render **parent: Parent this item will be added to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) **resizable: Enable resizing columns **reorderable: Enable reordering columns in header row **hideable: Enable hiding/disabling columns in context menu. **sortable: Enable sorting. **context_menu_in_body: Right-click on columns body/contents will display table context menu. **row_background: Set each RowBg color with ImGuiCol_TableRowBg or ImGuiCol_TableRowBgAlt (equivalent of calling TableSetBgColor with ImGuiTableBgFlags_RowBg0 on each row manually) **borders_innerH: Draw horizontal borders between rows. **borders_outerH: Draw horizontal borders at the top and bottom. **borders_innerV: Draw vertical borders between columns. **borders_outerV: Draw vertical borders on the left and right sides. **policy: sizing policy **no_host_extendX: Make outer width auto-fit to columns, overriding outer_size.x value. Only available when ScrollX/ScrollY are disabled and Stretch columns are not used. **no_host_extendY: Make outer height stop exactly at outer_size.y (prevent auto-extending table past the limit). Only available when ScrollX/ScrollY are disabled. Data below the limit will be clipped and not visible. **no_keep_columns_visible: Disable keeping column always minimally visible when ScrollX is off and table gets too small. Not recommended if columns are resizable. **precise_widths: Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth. **no_clip: Disable clipping rectangle for every individual columns. **pad_outerX: Default if BordersOuterV is on. Enable outer-most padding. Generally desirable if you have headers. **no_pad_outerX: Default if BordersOuterV is off. Disable outer-most padding. **no_pad_innerX: Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off). **scollX: Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Changes default sizing policy. Because this create a child window, ScrollY is currently generally recommended when using ScrollX. **scollY: Enable horizontal vertical. Returns: None """ try: yield internal_dpg.add_table(*args, header_row=header_row, width = width, height = height, inner_width = inner_width, show = show, parent = parent, before = before, resizable = resizable, reorderable = reorderable, hideable = hideable, sortable = sortable, context_menu_in_body = context_menu_in_body, row_background = row_background, borders_innerH = borders_innerH, borders_outerH = borders_outerH, borders_innerV = borders_innerV, borders_outerV = borders_outerV, policy = policy, no_host_extendX = no_host_extendX, no_host_extendY = no_host_extendY, no_keep_columns_visible = no_keep_columns_visible, precise_widths = precise_widths, no_clip = no_clip, pad_outerX = pad_outerX, no_pad_outerX = no_pad_outerX, no_pad_innerX = no_pad_innerX, scrollX = scrollX, scrollY = scrollY, id=id) finally: internal_dpg.end()
def child(name: str, *, show: bool = True, tip: str = "", parent: str = "", before: str = "", width: int = 0, height: int = 0, border: bool = True, popup: str = "", autosize_x: bool = False, autosize_y: bool = False, no_scrollbar: bool = False, horizontal_scrollbar: bool = False, menubar: bool = False): """Wraps add_child() 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. show: Decides if the item is shown of not. **tip: Adds a simple tooltip **parent: Parent to add this item to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) **width: Width of the item. **height: Height of the item. **border: Shows/Hides the border around the sides **popup: Name of the popup that will be tied to this item. **autosize_x: Autosize the window to fit its items in the x. **autosize_y: Autosize the window to fit its items in the y. **no_scrollbar: Disable scrollbars (window can still scroll with mouse or programmatically) **horizontal_scrollbar: Allow horizontal scrollbar to appear (off by default) **menubar: adds a bar to add menus Returns: None """ try: yield internal_dpg.add_child(name, show=show, tip=tip, parent=parent, before=before, width=width, height=height, border=border, popup=popup, autosize_x=autosize_x, autosize_y=autosize_y, no_scrollbar=no_scrollbar, horizontal_scrollbar=horizontal_scrollbar, menubar=menubar) finally: internal_dpg.end()
def menu(name: str, tip: str = "", parent: str = "", before: str = "", enabled: bool = True): try: yield dpg.add_menu(name, tip=tip, parent=parent, before=before, enabled=enabled) finally: dpg.end()
def tree_node(name: str, default_open: bool = False, tip: str = "", parent: str = "", before: str = ""): try: yield dpg.add_tree_node(name, default_open=default_open, tip=tip, parent=parent, before=before) finally: dpg.end()
def tab(name: str, closable: bool = False, tip: str = "", parent: str = "", before: str = ""): try: yield dpg.add_tab(name, closable=closable, tip=tip, parent=parent, before=before) finally: dpg.end()
def tooltip(tipparent: str, name: str, parent: str = "", before: str = "", show: bool = True): try: yield internalDPG.add_tooltip(tipparent, name, parent=parent, before=before, show=show) finally: internalDPG.end()
def collapsing_header(name: str, default_open: bool = False, closable: bool = False, tip: str = "", parent: str = "", before: str = ""): try: yield dpg.add_collapsing_header(name, default_open=default_open, closable=closable, tip=tip, parent=parent, before=before) finally: dpg.end()
def start_development_windows(logger: str): """ Starts doc, debug, and logger window """ add_doc_window(name="Core Documentation", x_pos=0, y_pos=800) end() show_logger() # for some reason the default logger doesn't show the first # log_info call so this clears that out. log_info("Clearing out initial issue with logger", logger=logger) add_debug_window(name="Debug", x_pos=0, y_pos=300) end()
def tab_bar(name: str, reorderable: bool = False, callback: str = "", parent: str = "", before: str = "", data_source: str = ""): try: yield dpg.add_tab_bar(name, reorderable=reorderable, callback=callback, parent=parent, before=before, data_source=data_source) finally: dpg.end()
def managed_columns(name: str, columns: int, border: bool = True, show: bool = True, parent: str = "", before: str = ""): try: yield internalDPG.add_managed_columns(name, columns, border=border, show=show, parent=parent, before=before) finally: internalDPG.end()
def menu_bar(*args, show: bool = True, parent: str = "", before: str = "", id:str=''): """Wraps add_menu_bar() 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. **show: Decides if the item is shown of not. **parent: Parent this item will be added to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) Returns: None """ try: yield internal_dpg.add_menu_bar(*args, show=show, parent=parent, before=before, id=id) finally: internal_dpg.end()
def node_editor(name: str, *, show: bool = True, parent: str = "", before: str = "", link_callback: Callable = None, delink_callback: Callable = None): """Wraps add_node_editor() 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. **parent: Parent to add this item to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) **show: sets if the item is shown or not window. **link_callback: Callback ran when a new link is created **delink_callback: Callback ran when a link is detached Returns: None """ try: yield internal_dpg.add_node_editor(name, show=show, parent=parent, before=before, link_callback=link_callback, delink_callback=delink_callback) finally: internal_dpg.end()
def child(name: str, tip: str = "", parent: str = "", before: str = "", width: int = 0, height: int = 0, border: bool = True): try: yield dpg.add_child(name, tip=tip, parent=parent, before=before, width=width, height=height, border=border) finally: dpg.end()
def tab_bar(name: str, reorderable: bool = False, callback: str = "", callback_data: str = "", show: bool = True, parent: str = "", before: str = ""): try: yield internalDPG.add_tab_bar(name, reorderable=reorderable, callback=callback, callback_data=callback_data, show=show, parent=parent, before=before) finally: internalDPG.end()
def node(name: str, *, label: str = "__DearPyGuiDefault", show: bool = True, draggable: bool = True, parent: str = "", before: str = "", x_pos: int = 100, y_pos: int = 100): """Wraps add_node() 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. **label: Displayed name of the item. **parent: Parent to add this item to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) **show: sets if the item is shown or not window. **draggable: Allow node to be draggable. **x_pos: x position the node will start at **y_pos: y position the node will start at Returns: None """ try: if label == "__DearPyGuiDefault": yield internal_dpg.add_node(name, show=show, parent=parent, before=before, draggable=draggable, x_pos=x_pos, y_pos=y_pos) else: yield internal_dpg.add_node(name, label=label, show=show, parent=parent, before=before, draggable=draggable, x_pos=x_pos, y_pos=y_pos) finally: internal_dpg.end()
def tooltip(tipparent: str, name: str, *, parent: str = "", before: str = "", show: bool = True): """Wraps add_tooltip() and automates calling end(). Args: tipparent: Sets the item's tool tip to be the same as the named item's tool tip. 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. **parent: Parent to add this item to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) **show: Decides if the item is shown of not. Returns: None """ try: yield internal_dpg.add_tooltip(tipparent, name, parent=parent, before=before, show=show) finally: internal_dpg.end()
def group(name: str, show: bool = True, tip: str = "", parent: str = "", before: str = "", width: int = 0, horizontal: bool = False, horizontal_spacing: float = -1.0): try: yield internalDPG.add_group(name, show=show, tip=tip, parent=parent, before=before, width=width, horizontal=horizontal, horizontal_spacing=horizontal_spacing) finally: internalDPG.end()
def _create_primary_window(self) -> None: core.set_main_window_title('Swift Duplicate Images Finder') core.set_main_window_size(self._app_windows_size['width'] + 20, self._app_windows_size['height'] + 65) with simple.window(self._primary_window_name): core.configure_item(self._primary_window_name, label='Duplicate Images Manager') core.add_menu_bar("MenuBar") core.add_menu("Actions") core.add_menu_item("Start new scan", callback=self._new_scan_click_callback) core.add_menu_item("Quit", callback=self._quit_app_click_handler) core.end() core.add_menu("Themes") core.add_menu_item("Dark", callback=self._theme_callback) core.add_menu_item("Light", callback=self._theme_callback) core.add_menu_item("Classic", callback=self._theme_callback) core.add_menu_item("Dark 2", callback=self._theme_callback) core.add_menu_item("Grey", callback=self._theme_callback) core.add_menu_item("Dark Grey", callback=self._theme_callback) core.add_menu_item("Cherry", callback=self._theme_callback) core.add_menu_item("Purple", callback=self._theme_callback) core.add_menu_item("Gold", callback=self._theme_callback) core.add_menu_item("Red", callback=self._theme_callback) core.end() core.add_menu("Tools") core.add_menu_item("Show Logger", callback=core.show_logger) core.end() core.add_menu("About") core.add_menu_item("Visit source page", callback=self._visit_source_page_click_callback) core.end() core.end()
def popup(popupparent: str, name: str, mousebutton: int = 1, modal: bool = False, parent: str = "", before: str = "", width: int = 0, height: int = 0): try: yield dpg.add_popup(popupparent, name, mousebutton=mousebutton, modal=modal, parent=parent, before=before, width=width, height=height) finally: dpg.end()
def node_attribute(name: str, *, show: bool = True, output: bool = False, static: bool = False, parent: str = "", before: str = ""): """Wraps add_node_attribute() 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. **parent: Parent to add this item to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) **show: sets if the item is shown or not window. **output: Set as output attribute **static: Set as static attribute Returns: None """ try: yield internal_dpg.add_node_attribute(name, show=show, parent=parent, before=before, output=output, static=static) finally: internal_dpg.end()
def menu(name: str, *, label: str = "__DearPyGuiDefault", show: bool = True, tip: str = "", parent: str = "", before: str = "", enabled: bool = True): """Wraps add_menu() 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. **label: Displayed name of the item. **show: Decides if the item is shown of not. **tip: Adds a simple tooltip **parent: Parent this item will be added to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) **enabled: Will enable or disable the menu. Returns: None """ try: if label == "__DearPyGuiDefault": yield internal_dpg.add_menu(name, show=show, tip=tip, parent=parent, before=before, enabled=enabled) else: yield internal_dpg.add_menu(name, label=label, show=show, tip=tip, parent=parent, before=before, enabled=enabled) finally: internal_dpg.end()
def submit_category(self, sender, data): if data: category_label = data["label"] category_color = data["color"] else: parent = dpg.get_item_parent(sender) input_id = parent.replace("newcategory", "") category_label = dpg.get_value(f"catlabel{input_id}") category_color = dpg.get_value(f"catcolor{input_id}") dpg.delete_item(parent) category = trackers.Category(parent=f"categories{self.id}") self.category_tracker.add_category(category) category.label = category_label category.color = category_color if data: category.complete = data["complete"] category.render() if not self.changes: item = dpg.get_item_configuration(self.parent) dpg.configure_item(self.parent, label="!" + item["label"]) self.changes = True # Render the Add Task button with simple.group(f"catitems{category.id}", parent=f"catgroup{category.id}"): dpg.add_group(f"cattasks{category.id}", parent=f"catitems{category.id}") dpg.end() dpg.add_indent() dpg.add_spacing(name=f"taskspace{category.id}") dpg.add_button( f"addtask{category.id}", label="Add New Task", callback=self.add_task, callback_data={"category": category.id}, ) dpg.unindent() return category.id
def tab(name: str, *, closable: bool = False, label: str = "__DearPyGuiDefault", show: bool = True, tip: str = "", parent: str = "", before: str = ""): """Wraps add_tab() 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. **closable: creates a button on the tab that can hide the tab. **label: Displayed name of the item. **show: Decides if the item is shown of not. **tip: Adds a simple tooltip. **parent: Parent to add this item to. (runtime adding) **before: This item will be displayed before the specified item in the parent. (runtime adding) Returns: None """ try: if label == "__DearPyGuiDefault": yield internal_dpg.add_tab(name, closable=closable, show=show, tip=tip, parent=parent, before=before) else: yield internal_dpg.add_tab(name, closable=closable, label=label, show=show, tip=tip, parent=parent, before=before) finally: internal_dpg.end()
def popup(popupparent: str, name: str, mousebutton: int = 1, modal: bool = False, parent: str = "", before: str = "", width: int = 0, height: int = 0, show: bool = True): try: yield internalDPG.add_popup(popupparent, name, mousebutton=mousebutton, modal=modal, parent=parent, before=before, width=width, height=height, show=show) finally: internalDPG.end()