GUIBRUSHR.GUI.WIDGET.MyFigure module

class GUIBRUSHR.GUI.WIDGET.MyFigure.MyFigure(title: str, message: str | None = None, type_data: str = 'Message', personal_size=None, image_path: str | None = None)[source]

Bases: Toplevel

A custom figure window that can display messages, plots, or images.

This class creates a Toplevel window that can be used to display various types of content: - Text messages - Matplotlib plots - Images

subplots

Number of subplots in the figure

Type:

Tuple[int, int]

title_plot

List of plot titles

Type:

List[str]

xlabel

List of x-axis labels

Type:

List[str]

ylabel

List of y-axis labels

Type:

List[str]

figure

The matplotlib figure object

Type:

Figure

type_data

Type of data being displayed (‘Message’, ‘Plot’, or ‘Image’)

Type:

str

ax

The matplotlib axes object(s)

Type:

Union[Axes, List[Axes]]

__init__(title: str, message: str | None = None, type_data: str = 'Message', personal_size=None, image_path: str | None = None) None[source]

Initialize the MyFigure window.

Parameters:
  • title – The window title

  • message – Text message to display when type_data is “Message”

  • type_data – Type of content to display (“Message”, “Plot”, or “Image”)

  • personal_size – Optional tuple (width, height) to determine window size

  • image_path – Path to the image file when type_data is “Image”

return_ax(title_plot: List[str], xlabel: List[str], ylabel: List[str], subplots=(1, 1), figsize: Tuple[int, int] = (8, 6), dpi: int = 100, hspace: float = 0.1, wspace: float = 0.1, height_ratios: List[float] | None = None, sharex: bool = False, sharey: bool = False) Any[source]

Create and return matplotlib axes for plotting.

Parameters:
  • title_plot – List of plot titles

  • xlabel – List of x-axis labels

  • ylabel – List of y-axis labels

  • subplots – Tuple of (rows, columns) for subplot layout

  • figsize – Figure size in inches (width, height)

  • dpi – Dots per inch for the figure

  • hspace – Height spacing between subplots

  • wspace – Width spacing between subplots

  • height_ratios – List of height ratios for subplots

  • sharex – Whether to share x-axis between subplots

  • sharey – Whether to share y-axis between subplots

Returns:

The matplotlib axes object(s)

create_figure(path_f: str, dpi: int, tight_layout: bool = True) None[source]

Create and save the figure with proper labels and formatting.

Parameters:
  • path_f – Path where to save the figure

  • dpi – Dots per inch for the saved figure

  • tight_layout – Whether to apply tight layout to the figure

close_figure() None[source]

Close the figure window and clean up resources.