跳转至

tkintertools.mpl.main

字数 183 个   代码 42 行   阅读时间 1 分钟   访问量

APIs for Matplotlib

🟢FigureCanvas

class public | Canvas FigureCanvasTkAgg

1
2
3
4
5
6
7
def __init__(
    self,
    master: Misc,
    figure: Figure,
    *args,
    **kwargs,
) -> None: ...
A canvas for interface of matplotlib

  • master: parent widget
  • figure: a Figure object from matplotlib

🟡_fix_size

method protected

1
2
3
4
def _fix_size(
    self,
    event: Event,
) -> None: ...
Correct the size of Figure

🟡_theme

method protected

1
2
3
4
def _theme(
    self,
    dark: bool,
) -> None: ...
Change the color theme of the Figure

🟡destroy

method public

1
2
3
def destroy(
    self,
) -> None: ...

🟢FigureToolbar

class public | NavigationToolbar2Tk

1
2
3
4
5
6
7
8
def __init__(
    self,
    master: tkinter.Misc | tkintertools.mpl.main.FigureCanvas,
    figure_canvas: tkintertools.mpl.main.FigureCanvas | None = None,
    *,
    pack_toolbar: bool = True,
    **kwargs,
) -> None: ...
An interface class for the matplotlib navigation cursor

  • master: parent widget
  • figure_canvas: the figure canvas on which to operate
  • pack_toolbar: if True, add the toolbar to the parent’s pack manager’s packing list during initialization with side="bottom" and fill="x".

TIPS:

If you want to use the toolbar with a different layout manager, use pack_toolbar=False

🟡_theme

method protected

1
2
3
4
def _theme(
    self,
    dark: bool,
) -> None: ...
Change the color theme of the Toolbar

🟡destroy

method public

1
2
3
def destroy(
    self,
) -> None: ...

🔵_forward_methods

function protected

1
2
3
4
def _forward_methods(
    source_object: object | type,
    target_object: object,
) -> None: ...

Forward methods and attributes of one object to another object

  • source_object: the source object, that is, the forwarded object
  • target_object: the target object, that is, the object to be forwarded

🔵set_mpl_default_theme

function public

1
2
3
4
5
def set_mpl_default_theme(
    theme: typing.Literal['light', 'dark'],
    *,
    apply_font: bool = False,
) -> None: ...

Set default color constants of matplotlib

  • theme: theme mode
  • apply_font: whether to use the font of tkintertools