Extension package for tkintertools to matplotlib
Project description
tkintertools-mpl
Extension package for tkintertools to matplotlib
📦 Installation
pip install tkintertools-mpl
[!IMPORTANT]
tkintertools: https://github.com/Xiaokang2022/tkintertools
👀 Preview
import math
import matplotlib.figure
import numpy
import tkintertools
import tkintertools.mpl as mpl
import tkintertools.style as style
mpl.set_mpl_default_theme(style.get_color_mode())
x = numpy.linspace(-math.tau, math.tau, 100)
y = numpy.sin(x)
figure = matplotlib.figure.Figure()
axes = figure.add_subplot()
axes.plot(x, y)
axes.set(xlabel='x', ylabel='y', title='Plotting based on the theme in tkt')
axes.legend(["$y=sin(x)$"])
axes.grid()
root = tkintertools.Tk((960, 720), title="tkintertools-mpl")
root.center()
canvas = tkintertools.Canvas(root, zoom_item=True)
canvas.place(width=960, height=720)
figure_canvas = mpl.FigureCanvas(canvas, figure)
toolbar = mpl.FigureToolbar(canvas, figure_canvas)
figure_canvas.pack(side="top", fill="both", expand=True)
root.mainloop()
import matplotlib.figure
import numpy
import tkintertools
import tkintertools.mpl as mpl
import tkintertools.style as style
mpl.set_mpl_default_theme(style.get_color_mode())
figure = matplotlib.figure.Figure()
axes = figure.add_subplot(projection='3d')
colors = ['r', 'g', 'b', 'y']
yticks = [3, 2, 1, 0]
for c, k in zip(colors, yticks):
xs = numpy.arange(20)
ys = numpy.random.rand(20)
cs = [c] * len(xs)
cs[0] = 'c'
axes.bar(xs, ys, zs=k, zdir='y', color=cs, alpha=0.7)
axes.set_xlabel('X')
axes.set_ylabel('Y')
axes.set_zlabel('Z')
axes.set_title("3D plotting with interoperability")
axes.set_yticks(yticks)
root = tkintertools.Tk((960, 720), title="tkintertools-mpl")
root.center()
canvas = tkintertools.Canvas(root, zoom_item=True)
canvas.place(width=960, height=720)
figure_canvas = mpl.FigureCanvas(canvas, figure)
toolbar = mpl.FigureToolbar(canvas, figure_canvas)
figure_canvas.pack(side="top", fill="both", expand=True)
root.mainloop()
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tkintertools_mpl-1.2.2.tar.gz.
File metadata
- Download URL: tkintertools_mpl-1.2.2.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8da852674c0bd979918ab9f9489284fe45faa6bf213ab86e92c703c34c4da41e
|
|
| MD5 |
bd8a36d7d114947e234803dc3de565bb
|
|
| BLAKE2b-256 |
adbe7c0d64a5a92c40bd5593f7f8fe4533950e1e95ced3f8d64e5a33d4fba888
|
File details
Details for the file tkintertools_mpl-1.2.2-py3-none-any.whl.
File metadata
- Download URL: tkintertools_mpl-1.2.2-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3317058863a5684324c5919e843bb13299ebff1f04bb322d9af912beb6e54a31
|
|
| MD5 |
2ebf5705df6fb8b42443fa258073049e
|
|
| BLAKE2b-256 |
06922e37602865f78bd7c7d0b9df0933119cafb4cdb36e95673438d3cb99e245
|