Skip to main content

# Custom-toolbar-button

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

custom_toolbar_button-0.1.0.tar.gz (95.8 kB view details)

Uploaded Source

File details

Details for the file custom_toolbar_button-0.1.0.tar.gz.

File metadata

  • Download URL: custom_toolbar_button-0.1.0.tar.gz
  • Upload date:
  • Size: 95.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for custom_toolbar_button-0.1.0.tar.gz
Algorithm Hash digest
SHA256 911d5ceea88ca8b86ae622d282923545c1a8a663f5b1566144d4e2328b234922
MD5 5de1f841a449c6b3b04dd94bc811f522
BLAKE2b-256 c352f43bd191be75595867a6a2eabbd6f2b34c6940984b28718534d2c1d30fb7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page