fixed_ratio_widget

class janim.gui.utils.fixed_ratio_widget.FixedRatioWidget(inside: QWidget, parent: QWidget | None = None)

Bases: QWidget

Allows the passed inside widget to fit within this widget at a fixed ratio

set_src_size(size: tuple[float, float]) None
update_inner_size(wnd_size: QSize) None
resizeEvent(event: QResizeEvent) None
staticMetaObject = PySide6.QtCore.QMetaObject("FixedRatioWidget" inherits "QWidget": )
janim.gui.utils.fixed_ratio_widget.get_proportional_scale_size(src_width, src_height, tg_width, tg_height)

Based on the target size information (tg_width, tg_height), get the maximum size that (src_width, src_height) can fit into the target area after proportional scaling