navigate.view.custom_widgets.DockableNotebook.DockableNotebook
- class navigate.view.custom_widgets.DockableNotebook.DockableNotebook(parent, root, *args, **kwargs)
Bases:
NotebookDockable Notebook that allows for tabs to be popped out into a separate windows by right-clicking on the tab. The tab must be selected before right-clicking.
- __init__(parent, root, *args, **kwargs)
Initialize Dockable Notebook
- Parameters:
parent (Tk parent widget.) – The parent widget being passed down for hierarchy and organization. Typically, a ttk.Frame or tk.Frame.
root (Tk top-level widget.) – Tk.tk GUI instance.
*args – Options for the ttk.Notebook class
**kwargs – Keyword options for the ttk.Notebook class
Methods
__init__(parent, root, *args, **kwargs)Initialize Dockable Notebook
dismiss(tab_widget)Dismiss the popout window.
find(event)Find the widget that was clicked on.
Get absolute position of mouse.
popout()Popout the currently selected tab.
set_tablist(tab_list)Setter for tab list
Attributes
- dismiss(tab_widget)
Dismiss the popout window.
This is called when the popout window is closed. It destroys the popout window and re‐inserts the tab into the notebook.
- Parameters:
tab_widget (ttk.Frame) – The tab widget to be dismissed.
- find(event: Event) → None
Find the widget that was clicked on.
Will check if the proper widget element in the event is what we expect.
In this case its checking that the label in the tab has been selected. It then gets the proper position and calls the popup.
- Parameters:
event (tk.Event) – Tkinter event object
- get_absolute_position() → tuple
Get absolute position of mouse.
This helps the popup menu appear where the mouse is right-clicked.
- Returns:
x, y – Coordinates to be used (x, y)
- Return type:
integers
- popout() → None
Popout the currently selected tab.
Gets the currently selected tab, the tabs name and checks if the tab name is in the tab list. If the tab is in the list, it’s removed from the list, hidden, and then passed to a new Top Level window.
- set_tablist(tab_list: list) → None
Setter for tab list
- Parameters:
tab_list (list) – The list of tab variables
- menu
Tkinter menu
- Type:
tk.Menu
- root
Tkinter root
- Type:
tk.Tk
- selected_tab_id
Selected tab id where user right-clicked.
- Type:
int
- tab_list
List of tab variables
- Type:
list