tkinter-tooltip


Nametkinter-tooltip JSON
Version 3.1.2 PyPI version JSON
download
home_pagehttps://github.com/gnikit/tkinter-tooltip
SummaryAn easy and customisable ToolTip implementation for Tkinter
upload_time2024-11-17 16:52:03
maintainerNone
docs_urlNone
authorGiannis Nikiteas
requires_python>=3.7
licenseMIT
keywords tkinter tktooltip tkinter-tooltip tooltip pop-up
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            <div align="center">

[![Downloads](https://pepy.tech/badge/tkinter-tooltip)](https://pepy.tech/project/tkinter-tooltip)
[![PyPI Latest Release](https://img.shields.io/pypi/v/tkinter-tooltip.svg)](https://pypi.org/project/tkinter-tooltip/)
[![Tests](https://github.com/gnikit/tkinter-tooltip/actions/workflows/main.yml/badge.svg)](https://github.com/gnikit/tkinter-tooltip/actions/workflows/main.yml)
[![Documentation](https://github.com/gnikit/tkinter-tooltip/actions/workflows/docs.yml/badge.svg)](https://github.com/gnikit/tkinter-tooltip/actions/workflows/docs.yml)
[![codecov](https://codecov.io/gh/gnikit/tkinter-tooltip/graph/badge.svg?token=D911RWCBZ5)](https://codecov.io/gh/gnikit/tkinter-tooltip)
[![PyPI - License](https://img.shields.io/pypi/l/tkinter-tooltip)](https://github.com/gnikit/tkinter-tooltip/blob/master/LICENSE)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

<!-- [![CodeFactor](https://www.codefactor.io/repository/github/gnikit/tkinter-tooltip/badge)](https://www.codefactor.io/repository/github/gnikit/tkinter-tooltip) -->

</div>

<div align="center">

[![GitHub Sponsor](https://img.shields.io/static/v1?style=social&label=Sponsor&message=%E2%9D%A4&logo=GitHub&color&link=%3Curl%3E)](https://github.com/sponsors/gnikit)
[![PyaPal](https://img.shields.io/static/v1?style=social&label=Donate&message=%E2%9D%A4&logo=Paypal&color&link=%3Curl%3E)](https://paypal.me/inikit)

</div>

<p align="center">
  <img src="https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/images/tooltip_logo.svg" />
</p>

# tkinter-tooltip

## What this is

This is a simple yet fully customisable tooltip/pop-up implementation for
`tkinter` widgets. It is capable of fully integrating with custom `tkinter`
themes both light and dark ones.

![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/images/header.png)

## Features

- normal tooltips
- show tooltip with `s` seconds `delay`
- tooltip tracks mouse cursor
- tooltip displays strings and string returning functions
- fully customisable, tooltip inherits underlying theme style

## Install

```shell
pip install tkinter-tooltip
```

## Examples

### Normal tooltips

By default the tooltip activates when entering and/or moving in the widget are
and deactivates when leaving and/or pressing any button.

![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/images/tootil-simple.png)

```python
import tkinter as tk
import tkinter.ttk as ttk
from tktooltip import ToolTip

app = tk.Tk()
b = ttk.Button(app, text="Button")
b.pack()
ToolTip(b, msg="Hover info")
app.mainloop()
```

### Delayed tooltip

![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/animations/tooltip-delayed.gif)

```python
import tkinter as tk
import tkinter.ttk as ttk
from tktooltip import ToolTip

app = tk.Tk()
b = ttk.Button(app, text="Button")
b.pack()
ToolTip(b, msg="Hover info", delay=2.0)   # True by default
app.mainloop()
```

### Tracking tooltip

Have the tooltip follow the mousse cursor around when moving.

![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/animations/tooltip-tracking.gif)

```python
import tkinter as tk
import tkinter.ttk as ttk
from tktooltip import ToolTip

app = tk.Tk()
b = ttk.Button(app, text="Button")
b.pack()
ToolTip(b, msg="Hover info", follow=True)   # True by default
app.mainloop()
```

### Function as tooltip

Here the tooltip returns the value of `time.asctime()` which updates with every
movement. You can control the refresh rate of the `ToolTip` through the `refresh`
argument by default it is set to `1s`.

![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/animations/tootip-function-refresh.gif)
![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/animations/tootip-function.gif)

```python
import time
import tkinter as tk
import tkinter.ttk as ttk
from tktooltip import ToolTip

app = tk.Tk()
b = ttk.Button(app, text="Button")
b.pack()
# NOTE: pass the function itself not the return value
ToolTip(b, msg=time.asctime, delay=0)
app.mainloop()
```

### Themed tooltip

`tkinter-tooltip` is fully aware of the underlying theme (in this case a dark theme),
and can even be furher customised by passing `tk` styling arguments to the tooltip

![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/animations/tootip-dark-theme.gif)

Style tooltip and underlying the button. If a full theme has been used then
the `ToolTip` will inherit the settings of the theme by default.

```python
import tkinter as tk
import tkinter.ttk as ttk
from tktooltip import ToolTip

app = tk.Tk()
s = ttk.Style()
s.configure("custom.TButton", foreground="#ffffff", background="#1c1c1c")
b = ttk.Button(app, text="Button", style="custom.TButton")
b.pack()
ToolTip(b, msg="Hover info", delay=0,
        parent_kwargs={"bg": "black", "padx": 5, "pady": 5},
        fg="#ffffff", bg="#1c1c1c", padx=10, pady=10)
app.mainloop()
```

## Notes

- Certain options do not match great with each other, a good example is `follow`
  and `delay` using small x/y offsets. This can cause the tooltip to appear
  inside the widget. Hovering over the tooltip will cause it to disappear and
  reappear, in a new position, potentially again inside the widget.

## Contributing

You can find the instructions on how to contribute in this project in the
[CONTRIBUTING.md](CONTRIBUTING.md) file.

## Acknowledgements

`tkinter-tooltip` is based on the original work performed by
[Tucker Beck](http://code.activestate.com/recipes/576688-tooltip-for-tkinter/)
licensed under an MIT License.

## License

[MIT](LICENSE) License

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/gnikit/tkinter-tooltip",
    "name": "tkinter-tooltip",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "tkinter, tktooltip, tkinter-tooltip, tooltip, pop-up",
    "author": "Giannis Nikiteas",
    "author_email": "giannis.nikiteas@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a9/f1/e864d09013055e4c372995214efbd217415d8c8e91af2dbc91aaabe81f39/tkinter_tooltip-3.1.2.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n\n[![Downloads](https://pepy.tech/badge/tkinter-tooltip)](https://pepy.tech/project/tkinter-tooltip)\n[![PyPI Latest Release](https://img.shields.io/pypi/v/tkinter-tooltip.svg)](https://pypi.org/project/tkinter-tooltip/)\n[![Tests](https://github.com/gnikit/tkinter-tooltip/actions/workflows/main.yml/badge.svg)](https://github.com/gnikit/tkinter-tooltip/actions/workflows/main.yml)\n[![Documentation](https://github.com/gnikit/tkinter-tooltip/actions/workflows/docs.yml/badge.svg)](https://github.com/gnikit/tkinter-tooltip/actions/workflows/docs.yml)\n[![codecov](https://codecov.io/gh/gnikit/tkinter-tooltip/graph/badge.svg?token=D911RWCBZ5)](https://codecov.io/gh/gnikit/tkinter-tooltip)\n[![PyPI - License](https://img.shields.io/pypi/l/tkinter-tooltip)](https://github.com/gnikit/tkinter-tooltip/blob/master/LICENSE)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n<!-- [![CodeFactor](https://www.codefactor.io/repository/github/gnikit/tkinter-tooltip/badge)](https://www.codefactor.io/repository/github/gnikit/tkinter-tooltip) -->\n\n</div>\n\n<div align=\"center\">\n\n[![GitHub Sponsor](https://img.shields.io/static/v1?style=social&label=Sponsor&message=%E2%9D%A4&logo=GitHub&color&link=%3Curl%3E)](https://github.com/sponsors/gnikit)\n[![PyaPal](https://img.shields.io/static/v1?style=social&label=Donate&message=%E2%9D%A4&logo=Paypal&color&link=%3Curl%3E)](https://paypal.me/inikit)\n\n</div>\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/images/tooltip_logo.svg\" />\n</p>\n\n# tkinter-tooltip\n\n## What this is\n\nThis is a simple yet fully customisable tooltip/pop-up implementation for\n`tkinter` widgets. It is capable of fully integrating with custom `tkinter`\nthemes both light and dark ones.\n\n![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/images/header.png)\n\n## Features\n\n- normal tooltips\n- show tooltip with `s` seconds `delay`\n- tooltip tracks mouse cursor\n- tooltip displays strings and string returning functions\n- fully customisable, tooltip inherits underlying theme style\n\n## Install\n\n```shell\npip install tkinter-tooltip\n```\n\n## Examples\n\n### Normal tooltips\n\nBy default the tooltip activates when entering and/or moving in the widget are\nand deactivates when leaving and/or pressing any button.\n\n![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/images/tootil-simple.png)\n\n```python\nimport tkinter as tk\nimport tkinter.ttk as ttk\nfrom tktooltip import ToolTip\n\napp = tk.Tk()\nb = ttk.Button(app, text=\"Button\")\nb.pack()\nToolTip(b, msg=\"Hover info\")\napp.mainloop()\n```\n\n### Delayed tooltip\n\n![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/animations/tooltip-delayed.gif)\n\n```python\nimport tkinter as tk\nimport tkinter.ttk as ttk\nfrom tktooltip import ToolTip\n\napp = tk.Tk()\nb = ttk.Button(app, text=\"Button\")\nb.pack()\nToolTip(b, msg=\"Hover info\", delay=2.0)   # True by default\napp.mainloop()\n```\n\n### Tracking tooltip\n\nHave the tooltip follow the mousse cursor around when moving.\n\n![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/animations/tooltip-tracking.gif)\n\n```python\nimport tkinter as tk\nimport tkinter.ttk as ttk\nfrom tktooltip import ToolTip\n\napp = tk.Tk()\nb = ttk.Button(app, text=\"Button\")\nb.pack()\nToolTip(b, msg=\"Hover info\", follow=True)   # True by default\napp.mainloop()\n```\n\n### Function as tooltip\n\nHere the tooltip returns the value of `time.asctime()` which updates with every\nmovement. You can control the refresh rate of the `ToolTip` through the `refresh`\nargument by default it is set to `1s`.\n\n![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/animations/tootip-function-refresh.gif)\n![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/animations/tootip-function.gif)\n\n```python\nimport time\nimport tkinter as tk\nimport tkinter.ttk as ttk\nfrom tktooltip import ToolTip\n\napp = tk.Tk()\nb = ttk.Button(app, text=\"Button\")\nb.pack()\n# NOTE: pass the function itself not the return value\nToolTip(b, msg=time.asctime, delay=0)\napp.mainloop()\n```\n\n### Themed tooltip\n\n`tkinter-tooltip` is fully aware of the underlying theme (in this case a dark theme),\nand can even be furher customised by passing `tk` styling arguments to the tooltip\n\n![alt](https://raw.githubusercontent.com/gnikit/tkinter-tooltip/master/assets/animations/tootip-dark-theme.gif)\n\nStyle tooltip and underlying the button. If a full theme has been used then\nthe `ToolTip` will inherit the settings of the theme by default.\n\n```python\nimport tkinter as tk\nimport tkinter.ttk as ttk\nfrom tktooltip import ToolTip\n\napp = tk.Tk()\ns = ttk.Style()\ns.configure(\"custom.TButton\", foreground=\"#ffffff\", background=\"#1c1c1c\")\nb = ttk.Button(app, text=\"Button\", style=\"custom.TButton\")\nb.pack()\nToolTip(b, msg=\"Hover info\", delay=0,\n        parent_kwargs={\"bg\": \"black\", \"padx\": 5, \"pady\": 5},\n        fg=\"#ffffff\", bg=\"#1c1c1c\", padx=10, pady=10)\napp.mainloop()\n```\n\n## Notes\n\n- Certain options do not match great with each other, a good example is `follow`\n  and `delay` using small x/y offsets. This can cause the tooltip to appear\n  inside the widget. Hovering over the tooltip will cause it to disappear and\n  reappear, in a new position, potentially again inside the widget.\n\n## Contributing\n\nYou can find the instructions on how to contribute in this project in the\n[CONTRIBUTING.md](CONTRIBUTING.md) file.\n\n## Acknowledgements\n\n`tkinter-tooltip` is based on the original work performed by\n[Tucker Beck](http://code.activestate.com/recipes/576688-tooltip-for-tkinter/)\nlicensed under an MIT License.\n\n## License\n\n[MIT](LICENSE) License\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An easy and customisable ToolTip implementation for Tkinter",
    "version": "3.1.2",
    "project_urls": {
        "Documentation": "https://gnikit.github.io/tkinter-tooltip",
        "Homepage": "https://github.com/gnikit/tkinter-tooltip",
        "Repository": "https://github.com/gnikit/tkinter-tooltip",
        "Tracker": "https://github.com/gnikit/tkinter-tooltip/issues"
    },
    "split_keywords": [
        "tkinter",
        " tktooltip",
        " tkinter-tooltip",
        " tooltip",
        " pop-up"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "faa0b1d00dce752c2a3dad72515196da8b40816eac8385b2f901352cee9086c5",
                "md5": "15007e22433a90f90a07f49d05c4afb2",
                "sha256": "5bad74f2d476d9e2418598b2438f06e4b658dd6a89ee39a0bbfebb4fb7fdeb7f"
            },
            "downloads": -1,
            "filename": "tkinter_tooltip-3.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "15007e22433a90f90a07f49d05c4afb2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 7793,
            "upload_time": "2024-11-17T16:52:01",
            "upload_time_iso_8601": "2024-11-17T16:52:01.732468Z",
            "url": "https://files.pythonhosted.org/packages/fa/a0/b1d00dce752c2a3dad72515196da8b40816eac8385b2f901352cee9086c5/tkinter_tooltip-3.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a9f1e864d09013055e4c372995214efbd217415d8c8e91af2dbc91aaabe81f39",
                "md5": "95feaee67a62034e093c2459094c193a",
                "sha256": "dac8a6720c851936dfea2d96f90920a4dac31b46b78379c5e0ef0b6ed8af2964"
            },
            "downloads": -1,
            "filename": "tkinter_tooltip-3.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "95feaee67a62034e093c2459094c193a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 859778,
            "upload_time": "2024-11-17T16:52:03",
            "upload_time_iso_8601": "2024-11-17T16:52:03.856651Z",
            "url": "https://files.pythonhosted.org/packages/a9/f1/e864d09013055e4c372995214efbd217415d8c8e91af2dbc91aaabe81f39/tkinter_tooltip-3.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-17 16:52:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gnikit",
    "github_project": "tkinter-tooltip",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "tkinter-tooltip"
}
        
Elapsed time: 0.83498s