跳转至

maliang.mpl.main

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

源代码:maliang/mpl/main.py

APIs for Matplotlib

🟢FigureCanvas

class public | Canvas FigureCanvasTkAgg

1
2
3
4
5
6
7
def __init__(
    self,
    master: tkinter.Misc,
    figure: matplotlib.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: tkinter.Event,
) -> None: ...
Correct the size of Figure.

🟡destroy

method public

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

🟡theme

method public

1
2
3
4
def theme(
    self,
    theme: typing.Literal['light', 'dark'],
) -> None: ...
Change the color theme of the Figure.

  • theme: the theme name

🟢FigureToolbar

class public | NavigationToolbar2Tk

1
2
3
4
5
6
7
8
def __init__(
    self,
    master: tkinter.Misc | FigureCanvas,
    figure_canvas: 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".

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

🟡destroy

method public

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

🟡theme

method public

1
2
3
4
def theme(
    self,
    theme: typing.Literal['light', 'dark'],
) -> None: ...
Change the color theme of the Toolbar.

  • theme: the theme name

🔵_forward_methods

function protected

1
2
3
4
def _forward_methods(
    src_obj: object | type,
    tgt_obj: object,
) -> None: ...
Forward methods and attributes of one object to another object.

  • src_obj: the source object, that is, the forwarded object
  • tgt_obj: 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 maliang