navigate.view.custom_widgets.hover.Hover
- class navigate.view.custom_widgets.hover.Hover(widget=None, text=None, type='free')
Bases:
object
Hover that allows for information to be displayed additionally without interrupting the GUI
Each instance of hover is intended to be an attribute of a tk or ttk widget (see validated fields or hovermixins), and by default is set only to show error messages
In this case, the parent widget is the Stage Control GUI y position label. To instantiate the description, widget.hover.setdescription(“Y position of the stage”)
Please note: when dealing with LabelInput widgets, be sure to use LabelInput.widget.hover.setdescription(), which will target the specific widget and not the LabelInput frame
Examples of proper usage are within stage_control_tab.py for both LabelInput and regular usage
- __init__(widget=None, text=None, type='free')
Initialize the Hover class
Initializes attributes and binds events.
- Parameters:
widget (bound widget.) – The widget to which the hover instance is bound, usually the one on which information is being provided
text (str variable) – Text to be displayed when the hover is shown (default set to None so the hover will not show at all)
type (str variable) – Represents the current state of the hover and whether it is in use at any given moment
Methods
__init__
([widget, text, type])Initialize the Hover class
get_type
()Getter for the type
Getter for description text
hide
(event)Event handler to hide the hover
hidetip
()Hides the hover and resets type.
setdescription
(text)Setter for description text
seterror
(text)Setter for the error message
show
(event)Event handler to show the hover
showtip
(text)Displays the hover
update_type
(newtype)Setter for the type
Attributes
The widget to which the hover instance is bound
The hover window
The id of the widget
The x position of the widget int: The y position of the widget
The x position of the widget int: The y position of the widget
The text to be displayed when the hover is shown
The current state of the hover
The current state of the hover
- get_type()
Getter for the type
- Returns:
type – The current state of the hover
- Return type:
str
- getdescription()
Getter for description text
- Returns:
type – The description text
- Return type:
str
- hide(event)
Event handler to hide the hover
- Parameters:
event (event) – The event instance
- hidetip()
Hides the hover and resets type.
- setdescription(text)
Setter for description text
- Parameters:
text (str) – Text to be displayed when hover is shown as a description
- seterror(text)
Setter for the error message
- Parameters:
text (str) – Error message to be displayed
- show(event)
Event handler to show the hover
- Parameters:
event (event) – The event instance
- showtip(text)
Displays the hover
- Parameters:
text (str) – The text to be displayed on the hover
- update_type(newtype)
Setter for the type
- Parameters:
newtype (str) – The new state of the hover
- description
The current state of the hover
- Type:
str
- id
The id of the widget
- Type:
int
- text
The text to be displayed when the hover is shown
- Type:
str
- tipwindow
The hover window
- Type:
tk.Toplevel
- type
The current state of the hover
- Type:
str
- widget
The widget to which the hover instance is bound
- Type:
tk.Widget
- x
The x position of the widget int: The y position of the widget
- Type:
int
- y
The x position of the widget int: The y position of the widget
- Type:
int