Skip to main content

Custom-toolbar-button

Using this package, you can add custom widgets(with icon image and callback function) in matplotlib's toolbar.

Example

  • Forward and backward widgets are by default, on click chart shift 5 step forward and backward resp.
import os

# import custom_toolbar_button before matplotlib pyplot 
from custom_toolbar_button import tool

import matplotlib.pyplot as plt

# ----- Your code ---- #

Forward Backward icon

  • You can give n number of widgets list using TOOLITEMS global variable.

TOOLITEMS is list of tuple[Widget name, Tooltip text, Icon png complete path with name, Callback function].

import os

# import custom_toolbar_button before matplotlib pyplot 
from custom_toolbar_button import tool

icons = tool.Icons(os.path.dirname(__file__))

"""
Callback function should have same structure as mention below (function callback_func)

cls_instance is NavigationToolbar instance
"""
def callback_func(cls_instance):
    """
	cls_instance: NavigationToolbar2TK or NavigationToolbar2QT
	"""
    def wrapper(): 
        print('Custom tool button example.')
    return wrapper


tool.TOOLITEMS = [(
                    "Python Icon",                      # Widget name 
                    "Tooltip Python icon",              # Tooltip text
                    icons.icon_path("pyicon.png"),      # Icon png complete path with name
                    callback_func                       # Callback function
                    )]


import matplotlib.pyplot as plt

# ----- Your code ---- #

Custom Python icon

Release files for custom-toolbar-button 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for custom-toolbar-button 0.1.1
File Size Uploaded
custom_toolbar_button-0.1.1.tar.gz 9.7 kB Details

Release files / custom_toolbar_button-0.1.1.tar.gz

Download URL custom_toolbar_button-0.1.1.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
769939de76f9cdf61e7e5c995ee3351d9d9c5b67c817f5c8b3ea32094521d211
BLAKE2b-256 checksum
How to use checksums
4607b25a64a13e6d5d0059f5397eb9189482176503bc5ab2a1606350c58ebdae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.2.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page