dearpygui_extend package
Module contents
- dearpygui_extend.add_file_browser(**kwargs)
A custom file browser with support for collapsed file sequences and extended functionality.
- Parameters:
tag (str) – Unique id for the filebrowser instance (if omitted, will be created automatically based on uuid. Otherwise user is expected to handle clashing tags)
label (str|tuple|list) – Label shown at window title and button widget (if “show_as_window” == True). Can be defined separately as a tuple/list of length 2: (‘label on button’, ‘label on filebrowser window’). Accepts constants: file_browser.ICON_FILE, file_browser.ICON_FILES, file_browser.ICON_FOLDER to show built-in icons as an image button instead of a label.
width (int) – Item width
height (int) – Item height
parent (int) – The filebrowser parent item
pos (tuple) – File browser window position as (posX, posY)
default_path (str) – Initial path (filebrowser will expand user home folder ‘~’, if present)
collapse_sequences (bool) – Collapse numbered file sequences into a single entry.
collapse_sequences_checkbox (bool) – Displays the checkbox option to turn on/off display of collapsed sequences.
sequence_padding (str) – Padding mask to represent frame numbers in collapsed sequences. (example: “#” –> “MyImage.####.png”)
show_hidden_files (bool) – Display hidden files and folders (starting with “.”)
path_input_style (int) – How the user will input the filebrowser directory: file_browser.PATH_INPUT_STYLE_TEXT_ONLY, file_browser.PATH_INPUT_STYLE_BREADCRUMB, file_browser.PATH_INPUT_STYLE_BOTH
add_filename_tooltip (bool) – Adds a tooltip to help visualizing large filenames (if file name exceeds “tooltip_min_length”)
tooltip_min_length (int) – Minimum filename length to be displayed as tooltip.
icon_size (int) – Built-in icons size multiplier
filetype_filter (list) – A list (of dicts) for the allowed file extensions combo. Expected format of each list item is: {‘label’: ‘Images’, formats: [‘png’, ‘jpg’, ‘svg’]}
filetype_filter_default (int) – The default selected element from “filetype_filter” list
expand_sequences_on_callback (int) – Expands collapsed sequences to multiple files when sending values to callbacks
allow_multi_selection (bool) – Allow user to select multiples files/folders
allow_drag (bool) – Allow files/folders to be dragged to other UI elements.
allow_create_new_folder (bool) – Displays an icon to create a new folder on the header
dirs_only (bool) – List directories only
show_as_window (bool) – The filebrowser can be displayed inline or as a separate window. If “show_as_window==True” only a button widget is displayed inline, and the full filebrowser window is shown when user clicks the button. (See “label” for more info)
modal_window (bool) – Create a modal window if “show_as_window”==True ? (IMPORTANT: currently there is a bug where the “allow_create_new_folder” popup will not display on a modal window!)
show_ok_cancel (bool) – Display action buttons at the bottom. Result of “callback” happens when user clicks these buttons. (Alternatively, leave this option off and work with draggable items using “allow_drag” and drop_callbacks instead)
show_nav_icons (bool) – Display top navigation icons (“<”, “^”, “create folder”, “home”). They can take considerable UI space depending on parent container size, so disabling this might help vizualize more of the current path being browsed.
user_data (any) – User data for callbacks
callback (callable) – Callback executed when OK/Cancel buttons are pressed (if “show_ok_cancel==True”). Args “sender”(int), “files”(list) and “cancel_pressed”(bool) are available.
selection_callback (callable) – Callback executed when user selects files/folders inside the browser. Args “sender”(int), “files”(list) are available.
- Returns:
A FileBrowser object. You can access the “tag” class attribute to refer to the newly created FileBrowser instance.
- dearpygui_extend.add_layout(layout, **kwargs)
A window layouting system based on a simple human readable format.
- Parameters:
layout (str) – A string containing the layout. Uses tab based identation syntax (More info below).
parent (int) – The layout parent item.
border (bool) – Displays a border around panes.
resizable (bool) – Allow pane columns to be resized.
debug (bool) – Displays random colors as indication for each pane.
height_factor (float) – Limits the layout height within its parent container (value range: 0-1)
- Returns:
A Layout object. You can access the “root” class attribute to refer to the top most dpg item of the layout.
- LAYOUT - the top most item (required as the first line). Accepts 3 positional parameters:
name: the main layout table tag
halign: horizontal alignment mode (left | center | right)
valign: vertical alignment mode (top | center | bottom)
important: If defined, global layout alignment options will be used for all columns. (Any column can override this value with its own alignment parms).
- ROW - a row item. Accepts 1 positional parameter:
size: row height as a normalized 0-1 value. (If omitted, remaining height will be automatically distributed between all the rows without this parm)
- COL - a column item. Accepts 4 positional parameters:
name: the dpg container tag, that you can access later to put the child widgets on.
size: the column width as a normalized 0-1 value. (If omitted, remaining width will be automatically distributed between all the columns without this parm)
halign: horizontal alignment mode (left | center | right)
valign: vertical alignment mode (top | center | bottom)
- dearpygui_extend.add_movable_group(**kwargs)
A group with drag’n’drop/moving capabilities
- Parameters:
title (str) – Group title (text widget shown at the top).
width (int) – Item width.
height (int) – Item height.
title_color (tuple) – Title color (a simple item theme is internally assigned to the group title)
same_window_only (bool) – Only allow the group to be moved within its parent window.
drop_behavior (int) – The default action for when a movable group is dropped onto another group. (movable_group.SWAP or movable_group.REPLACE)
category (str) – The group category. Categories can be used in conjunction with “droppable_categories” to filter where a movable_group can be dropped.
droppable_categories (list) – The list of categories allowed to be dropped onto this group.
on_drop_changes (dict) – The contents of this dict will be applied whenever this group is dropped over another group (dict keys should match movable_group() arguments). You can use this to change a group category after the group is moved, for example.
drop_callback (callable) – Callback executed when group is moved. Args “source” and “target” are available.
user_data (any) – Additional user_data. Because movable_group() takes over the “user_data” arg for internal manipulations, you’ll need to access your group user_data inside the ‘user’ sub-key: item[‘user_data’][‘user’]
parent (int) – The group parent item.
- Returns:
A dearpygui item id
- class dearpygui_extend.file_browser(tag=None, label='Choose file', width=-1, height=500, pos=None, parent=None, default_path='~', collapse_sequences=True, collapse_sequences_checkbox=True, sequence_padding='#', show_hidden_files=False, path_input_style=1, add_filename_tooltip=False, tooltip_min_length=100, icon_size=1, filetype_filter=None, filetype_filter_default=0, expand_sequences_on_callback=True, allow_multi_selection=True, allow_drag=True, allow_create_new_folder=True, dirs_only=False, show_as_window=False, modal_window=False, show_ok_cancel=False, show_nav_icons=True, callback=None, selection_callback=None, user_data=None)
Bases:
FileBrowser
- class dearpygui_extend.layout(layout='LAYOUT new_layout', parent=None, border=False, resizable=False, debug=False, height_factor=1)
Bases:
Layout
- class dearpygui_extend.movable_group(title='Group', width=200, height=100, title_color=(0, 120, 180, 255), same_window_only=False, drop_behavior=0, category=None, droppable_categories=None, on_drop_changes=None, drop_callback=None, user_data=None, parent=None)
Bases:
MovableGroup