ccu.fancyplots._gui.tooltip

A robust tooltip class.

This module provides the Tooltip class.

class ccu.fancyplots._gui.tooltip.Tooltip(parent: Widget | Widget, *, bg: str = '#000000', pad: tuple[float, float, float, float] = (5, 3, 5, 3), text: str = '', waittime: int = 400, wraplength: float = 250)[source]

Bases: object

Create a tooltip for a given widget as the mouse goes on it.

see:

http://stackoverflow.com/questions/3221956/

what-is-the-simplest-way-to-make-tooltips- in-tkinter/36221216#36221216

http://www.daniweb.com/programming/software-development/

code/484591/a-tooltip-class-for-tkinter

  • Originally written by vegaseat on 2014.09.09.

  • Modified to include a delay time by Victor Zaccardo on 2016.03.25.

Variables:
  • parent – The widget over which the user must hover to activate the tooltip.

  • bg – The tooltip background as a hex string. Defaults to "#FFFFEA".

  • pad – A 4-tuple (left, top, bottom, right), indicating the padding around the text within the tooltip (in pixels).

  • text – The text displayed in the tooltip. Defaults to an empty string.

  • waittime – Time before displaying (in milliseconds). Defaults to 400.

  • wraplength – Length before wrapping text (in pixels). Defaults to 250.

Create a tooltip.

Parameters:
  • parent – The parent widget over which one must hover to generate the tooltip.

  • bg – The tooltip background. Defaults to “#FFFFEA”.

  • pad – The padding to use for the tooltip. Defaults to (5, 3, 5, 3).

  • text – The text to display on the tooltip. Defaults to “”.

  • waittime – The time (in milliseconds) to wait for a user to hover before generating the tooltip. Defaults to 400.

  • wraplength – The character length at which the tooltip message will wrap. Defaults to 250.

_bind_keys() None[source]

Configure key bindings.

hide() None[source]

Hide the tooltip.

on_enter(_: Event | None = None) None[source]

Begin counting to display the tooltip.

on_leave(_: Event | None = None) None[source]

Stop counting to display the tooltip.

schedule() None[source]

Plan to display the tooltip.

show() None[source]

Show the tooltip.

unschedule() None[source]

Cancel scheduling to show the tooltip.