Add customizable tooltips to any Tkinter widget.
- Install in your enviroment:
pip install git+https://github.com/Nenotriple/TkToolTip.git
- Import within your python script:
from TkToolTip.TkToolTip import TkToolTip as Tip
A) Directly create a tooltip:
Tip.create(widget, text="example")
B) Create and store a tooltip for later configuration:
-
tooltip = Tip.create(widget, text="example")
-
tooltip.config(text="Example!")
widget
: tkinter.Widget
- The widget to attach the tooltip to
text
: str, optional
- Tooltip text (default is an empty string)
delay
: int, optional
- Delay before showing the tooltip in milliseconds (default is
0
)
padx
: int, optional
- X-offset of the tooltip from the origin (default is
0
)
pady
: int, optional
- Y-offset of the tooltip from the origin (default is
0
)
ipadx
: int, optional
- Horizontal internal padding (default is
0
)
ipady
: int, optional
- Vertical internal padding (default is
0
)
state
: str, optional
- Tooltip state, "normal" or "disabled" (default is
None
)
bg
: str, optional
- Background color (default is
"#ffffee"
)
fg
: str, optional
- Foreground (text) color (default is
"black"
)
font
: tuple, optional
- Font of the text (default is
("TkDefaultFont", 8, "normal")
)
borderwidth
: int, optional
- Border width (default is
1
)
relief
: str, optional
- Border style (default is
"solid"
)
justify
: str, optional
- Text justification (default is
"center"
)
wraplength
: int, optional
- Maximum line width for text wrapping (default is
0
, which disables wrapping)
fade_in
: int, optional
- Fade-in time in milliseconds (default is
125
)
fade_out
: int, optional
- Fade-out time in milliseconds (default is
50
)
origin
: str, optional
- Origin point of the tooltip,
"mouse"
or"widget"
(default is"mouse"
)