Ejemplo n.º 1
0
def menu(name: str,
         label: str = "__DearPyGuiDefault",
         show: bool = True,
         tip: str = "",
         parent: str = "",
         before: str = "",
         enabled: bool = True):
    try:
        if label == "__DearPyGuiDefault":
            yield internalDPG.add_menu(name,
                                       show=show,
                                       tip=tip,
                                       parent=parent,
                                       before=before,
                                       enabled=enabled)
        else:
            yield internalDPG.add_menu(name,
                                       label=label,
                                       show=show,
                                       tip=tip,
                                       parent=parent,
                                       before=before,
                                       enabled=enabled)
    finally:
        internalDPG.end()
Ejemplo n.º 2
0
def menu(*args,
         label: str = "",
         show: bool = True,
         parent: str = "",
         before: str = "",
         enabled: bool = True,
         id: str = '',
         indent=-1):
    """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.
        **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:
        widget = internal_dpg.add_menu(*args,
                                       label=label,
                                       show=show,
                                       parent=parent,
                                       before=before,
                                       enabled=enabled,
                                       id=id,
                                       indent=indent)
        internal_dpg.push_container_stack(widget)
        yield widget
    finally:
        internal_dpg.pop_container_stack()
Ejemplo n.º 3
0
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()
Ejemplo n.º 4
0
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 _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()
Ejemplo n.º 6
0
 def _setup_add_widget(self, dpg_args) -> None:
     dpgcore.add_menu(self.id, **dpg_args)