gui.popups¶
- gui.popups.center_popup(root, popup)¶
Util for positioning a popup in the center of the root window
- class gui.popups.BackendPopup(gui, title: str, entry_text, buttons: list, done_callback=None, **kwargs)¶
A Popup for editing params in dictionary form during a backend process.
- Parameters
gui – GUI to use as the window’s master
title – title of the popup window
entry_text – json-serializable object to print in the entry window
buttons – list of tuples of the form: (button name: str, response string: str, return params: bool)
- done_callback args:
- if the button’s return params tuple entry is True:
tuple: (response_string, params)
- else:
(response_string,)
- __init__(gui, title: str, entry_text, buttons: list, done_callback=None, **kwargs)¶
Construct a toplevel widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, menu, relief, screen, takefocus, use, visual, width.
- class gui.popups.EntryPopup(gui, title: str, width=30, height=10, multiline=False, default_text='', transient=True, save_text='Save', save_handler=None, cancel_text='Cancel', cancel_handler=None, **kwargs)¶
A Popup for inputting a single-line entry, like for a name The constructor requires the gui, the params dict, and the save and cancel callbacks.
After the cancel callback is called, the popup is destroyed. However, the save callback MUST RETURN TRUE for the popup to be destroyed
The save callbacks is provided the edited dict parsed from the window’s input The save callback is only called if the json is valid; otherwise an error is shown in the popup
- __init__(gui, title: str, width=30, height=10, multiline=False, default_text='', transient=True, save_text='Save', save_handler=None, cancel_text='Cancel', cancel_handler=None, **kwargs)¶
Construct a toplevel widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, menu, relief, screen, takefocus, use, visual, width.
- class gui.popups.ParamPopup(gui, title: str, params: dict, save_handler=None, cancel_handler=None, **kwargs)¶
A Popup for editing params in dictionary form. The constructor requires the gui, the params dict, and the save and cancel callbacks.
After the cancel callback is called, the popup is destroyed. However, the save callback MUST RETURN TRUE for the popup to be destroyed
The save callbacks is provided the edited dict parsed from the window’s input The save callback is only called if the json is valid; otherwise an error is shown in the popup
- __init__(gui, title: str, params: dict, save_handler=None, cancel_handler=None, **kwargs)¶
Construct a toplevel widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, menu, relief, screen, takefocus, use, visual, width.
- class gui.popups.CheckboxPopup(gui, title: str, checkboxes: dict, save_handler=None, cancel_handler=None, save_button_title='Save', cancel_button_title='Cancel', **kwargs)¶
A Popup for editing checkboxes The constructor requires the gui, the checkboxes dict, and the save and cancel callbacks.
The checkboxes dict should be of the form {checkbox_name: IntVar}
After the cancel callback is called, the popup is destroyed. However, the save callback MUST RETURN TRUE for the popup to be destroyed
The save callbacks is not provided any params
- __init__(gui, title: str, checkboxes: dict, save_handler=None, cancel_handler=None, save_button_title='Save', cancel_button_title='Cancel', **kwargs)¶
Construct a toplevel widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, menu, relief, screen, takefocus, use, visual, width.
- class gui.popups.AddPopup(gui, title: str, parent_cls: Type[parameterized.parameterized.ParameterizedInterface], add_handler=None, done_handler=None, **kwargs)¶
A Popup for adding parameterized objects to a list. This is used for the features and results.
The constructor requires the gui, the window title, the parent class, and the add and done callbacks.
This popup creates a list of all visible sub types of the parent class with entries for the editable params. Each subtype has an add button
Clicking the add button triggers the add handler, which is passed the subtype’s params dict that can be used to create a new object
If the add_handler or done_handler return true, the window will close
- __init__(gui, title: str, parent_cls: Type[parameterized.parameterized.ParameterizedInterface], add_handler=None, done_handler=None, **kwargs)¶
Construct a toplevel widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, menu, relief, screen, takefocus, use, visual, width.
- class gui.popups.ReorderableListbox(master, **kw)¶
A Tkinter listbox with drag & drop reordering of lines
- __init__(master, **kw)¶
Construct a listbox widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, cursor, exportselection, fg, font, foreground, height, highlightbackground, highlightcolor, highlightthickness, relief, selectbackground, selectborderwidth, selectforeground, selectmode, setgrid, takefocus, width, xscrollcommand, yscrollcommand, listvariable.
- orderChangedEventHandler()¶
- onLeave(event)¶
- onEnter(event)¶
- setCurrent(event)¶
- toggleSelection(event)¶
- moveElement(source, target)¶
- unlockShifting()¶
- lockShifting()¶
- shiftSelection(event)¶
- class gui.popups.SortablePopup(gui, title: str, list_items, done_handler=None, **kwargs)¶
- __init__(gui, title: str, list_items, done_handler=None, **kwargs)¶
Construct a toplevel widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, menu, relief, screen, takefocus, use, visual, width.
- class gui.popups.CustomFileBrowser(gui, title: str, initial_path, mode='open', done_handler=None, get_directory_handler=None, initial_file='', **kwargs)¶
- __init__(gui, title: str, initial_path, mode='open', done_handler=None, get_directory_handler=None, initial_file='', **kwargs)¶
Mode is either ‘open’, ‘open_multi’ or ‘save’
In save mode, returns the full path In open mode, returns full path In open_multi mode, returns list of full paths
get_directory_handler is pass a path and a kw arg: callback which can be given a path & directoy contents to update this popup and it should either return None, None or the full path and contents
- update_popup(path, items)¶
- static format_file_size(num)¶
- static format_modified_time(t)¶
- static get_directory_contents(directory, **kwargs)¶