tkinter-tooltip


Nametkinter-tooltip JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://github.com/gnikit/tkinter-tooltip
SummaryAn easy and customisable ToolTip implementation for Tkinter
upload_time2024-02-03 18:53:29
maintainer
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": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "tkinter,tktooltip,tkinter-tooltip,tooltip,pop-up",
    "author": "Giannis Nikiteas",
    "author_email": "giannis.nikiteas@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/44/ec/410edd2945b8bffc686b0023f044dab2dabf36b2782b39489996c43b303f/tkinter-tooltip-3.0.0.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.0.0",
    "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": "b2a6bf499f7fa722b039c3b9123261aeba1365dc87e1a45fa31835752b35e547",
                "md5": "c76a63e47ec953cb16ca74c762b0fdc8",
                "sha256": "b49b706a35c893f43d69b99c0721356889584dc2e94151cb96f164e0f9585adc"
            },
            "downloads": -1,
            "filename": "tkinter_tooltip-3.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c76a63e47ec953cb16ca74c762b0fdc8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 7746,
            "upload_time": "2024-02-03T18:53:27",
            "upload_time_iso_8601": "2024-02-03T18:53:27.839972Z",
            "url": "https://files.pythonhosted.org/packages/b2/a6/bf499f7fa722b039c3b9123261aeba1365dc87e1a45fa31835752b35e547/tkinter_tooltip-3.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "44ec410edd2945b8bffc686b0023f044dab2dabf36b2782b39489996c43b303f",
                "md5": "835f7ff446e922be3b87eeb806e79cbd",
                "sha256": "7ef1f7b36ab5a156868fb1e00ce65077c5d7128211d4137714b0bfe1af863c78"
            },
            "downloads": -1,
            "filename": "tkinter-tooltip-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "835f7ff446e922be3b87eeb806e79cbd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 859629,
            "upload_time": "2024-02-03T18:53:29",
            "upload_time_iso_8601": "2024-02-03T18:53:29.731462Z",
            "url": "https://files.pythonhosted.org/packages/44/ec/410edd2945b8bffc686b0023f044dab2dabf36b2782b39489996c43b303f/tkinter-tooltip-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-03 18:53:29",
    "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.18218s