Class BoxMixin
 This mixin contains the most important methods of box-like elements (boxes and box items). 
Declaration
class BoxMixin
source linkDocumentation
Methods
▶ def box(self, *, x: Union[float, str] = None, y: Union[float, str] = None, ...) -> Box  Creates a new child box. 
 def box( 
self,
*,
x: Union[float, str] = None,
y: Union[float, str] = None,
width: Union[float, str] = None,
height: Union[float, str] = None,
show: str = None,
p_left: float = None,
p_right: float = None,
p_top: float = None,
p_bottom: float = None,
p_x: float = None,
p_y: float = None,
padding: float = None,
horizontal=False,
z_level: int = None,
prepend=False,
above: BoxMixin = None,
below: BoxMixin = None,
name: str = None,
 ) -> Box 
 Parameters
- x : Union[float, str] 
X position of the box.
 - y : Union[float, str] 
Y position of the box.
Possible values: None, number, "NN", "NN%", "[NN%]", or a dynamic coordinate,
where NN is a number.
 - width : Union[float, str] 
Width of the box.
 - height : Union[float, str] 
Height of the box.
Possible values: None, number, "NN", "NN%", "fill", "fill(NN)".
 - show : str 
Fragment selector that decides in which fragments should the box be visible.
Possible values: None, a number, "XX-XX", "XX+" where XX is a number, "next" or "last"
 - p_left : float 
Left padding of the box.
 - p_right : float 
Right padding of the box.
 - p_top : float 
Top padding of the box.
 - p_bottom : float 
Bottom padding of the box.
 - p_x : float 
Sets both left and right padding of the box.
 - p_y : float 
Sets both top and bottom padding of the box.
 - padding : float 
Sets all four padding values of the box (left, right, top, bottom):
 - horizontal : bool 
If True, use horizontal layout: children will be placed in a row.
If False, use vertical layout (the default): children will be placed in a column.
 - z_level : int 
Sets the Z-level of the box.
    If None, the parent z_level will be used.
    z_level of the top-level box is 0.
    If z_level is X then all boxes with a *smaller* z_level than X is painted before
    this box. - prepend : bool 
If True, the new box is inserted as the first child of its parent.
Otherwise it is inserted as the last child.
 - above : Box 
The new box will be inserted into its parent right after the passed box.
The passed box has to be a child of the parent box.
 - below : Box 
The new box will be inserted into its parent right before the passed box.
The passed box has to be a child of the parent box.
 - name : str 
Name of the box (used for debugging purposes).
 
▶ def code(self, language: str, text: str, *, tabsize=4, ...) -> textboxitem.TextBoxItem  Draws a code snippet with syntax highlighting. 
 def code( 
self,
language: str,
text: str,
*,
tabsize=4,
line_numbers=False,
style="code",
use_styles=False,
escape_char="~",
scale_to_fit=False,
rotation: float = None,
 ) -> textboxitem.TextBoxItem 
 Parameters
- language : str 
Language used for syntax highlighting.
 - text : str 
Content of the code snippet.
 - tabsize : int 
Number of spaces generated by tab characeters.
 - line_numbers : bool 
If True, line numbers will be drawn in the code snippet.
 - style : str 
Name of style used for drawing the code snippet.
 - use_styles : bool 
If True, inline styles will be evaluated in the code snippet.
 - escape_char : str 
Escape character for creating inline styles in the code snippet.
 - scale_to_fit : bool 
If True, scales the code snippet to fit its parent box.
 - rotation : float 
Rotate the code snippet by the given amount of degrees clockwise around the center
of the snippet.
 
▶ def ellipse(self, color=None, bg_color=None, stroke_width=1, ...) -> boxitem.BoxItem  Draws an ellipse. The dimensions of the ellipse will be set to the dimensions of its parent box. If you want to draw a circle, use a square parent box. 
 def ellipse( 
self,
color=None,
bg_color=None,
stroke_width=1,
stroke_dasharray=None,
rotation: float = None,
 ) -> boxitem.BoxItem 
 Parameters
- color : str 
Color of the ellipse edge.
 - bg_color : str 
Color of the ellipse background.
 - stroke_width : float 
Width of the ellipse edge.
 - stroke_dasharray : str 
SVG dash effect of the ellipse edge.
 - rotation : float 
Rotate the ellipse by the given amount of degrees clockwise around the center of the
ellipse.
 
▶ def fbox(self, **kwargs) -> Box  Shortcut for `box(width="fill", height="fill")`. 
 ▶ def image(self, source: Union[str, BinaryIO, bytes], *, ...) -> boxitem.BoxItem  Draws an SVG/PNG/JPEG/ORA image, detected by the extension of the `filename`. 
 def image( 
self,
source: Union[str, BinaryIO, bytes],
*,
image_type: str = None,
scale: float = None,
fragments=True,
show_begin=1,
select_fragments: List[Union[int, None]] = None,
rotation: float = None,
 ) -> boxitem.BoxItem 
 Parameters
- source : str or BinaryIO or bytes 
Filename of the image or file-like object. If file-like object is used, image_type has
to be defined.
 - image_type : str 
Possible values: "svg", "ora", "jpeg", "png" or None (= autodetect from filename).
 - scale : float 
Scale of the resulting image.
< 1.0 -> Smaller size.
= 1.0 -> Original size.
> 1.0 -> Larger size.
 - fragments : bool 
Load fragments from the image (only applicable for SVG and ORA images).
 - show_begin : int 
Fragment from which will the image fragments be shown.
Only applicable if `fragments` is set to True.
 - select_fragments : List[Union[int, None]] 
Select which fragments of the image should be drawn at the given fragments of the
slide.
`select_fragments=[1, 3, None, 2]`
Would render the first image fragment in the first slide fragment, the third image
fragment in the second slide fragment, no image fragment in the third slide fragment
and the second image fragment in the fourth slide fragment.
 - rotation : float 
Rotate the image by the given amount of degrees clockwise around the center of the
image.
 
▶ def line(self, points, color="black", stroke_width=1, ...) -> boxitem.BoxItem  Draws a line. 
 def line( 
self,
points,
color="black",
stroke_width=1,
stroke_dasharray: str = None,
start_arrow: arrow.Arrow = None,
end_arrow: arrow.Arrow = None,
 ) -> boxitem.BoxItem 
 Parameters
▷ def mid_point(self) -> lazy.LazyPoint  Create a lazy point that resolves to the center of the box. 
 ▶ def overlay(self, **kwargs) -> Box  Shortcut for `box(x=0, y=0, width="100%", height="100%")`. 
 The resulting box will overlay the whole area of the current box.
▷ def p(self, x, y) -> lazy.LazyPoint  Create a lazy point relative to the top-left corner of the box. 
 ▶ def path(self, commands, color="black", bg_color: str = None, ...) -> boxitem.BoxItem  Draws a SVG path. 
 def path( 
self,
commands,
color="black",
bg_color: str = None,
stroke_width=1,
stroke_dasharray: str = None,
end_arrow: arrow.Arrow = None,
 ) -> boxitem.BoxItem 
 Parameters
▶ def polygon(self, points, color: str = None, bg_color: str = None, ...) -> boxitem.BoxItem  Draws a polygon. 
 def polygon( 
self,
points,
color: str = None,
bg_color: str = None,
stroke_width=1,
stroke_dasharray: str = None,
rotation=None,
 ) -> boxitem.BoxItem 
 Parameters
- points : list 
List of points of the polygon.
Each point can be either a 2-element tuple/list with (x, y) coordinates or a
`value.LazyPoint`.
 - color : str 
Color of the edge of the polygon.
 - bg_color : str 
Color of the background of the polygon.
 - stroke_width : float 
Width of the edge of the polygon.
 - stroke_dasharray : str 
SVG dash effect of the edge of the polygon.
 - rotation : float 
Rotate the polygon by the given amount of degrees clockwise around the centroid of the
polygon.
 
▶ def rect(self, color: str = None, bg_color: str = None, ...) -> boxitem.BoxItem  Draws a rectangle around the box. 
 def rect( 
self,
color: str = None,
bg_color: str = None,
stroke_width=1,
stroke_dasharray: str = None,
rx: float = None,
ry: float = None,
rotation: float = None,
 ) -> boxitem.BoxItem 
 Parameters
- color : str 
Color of the rectangle edge.
 - bg_color : str 
Color of the rectangle background.
 - stroke_width : float 
Width of the rectangle edge.
 - stroke_dasharray : str 
SVG dash effect of the rectangle edge.
 - rx : float 
x-axis radius of the rectangle. Use it if you want rounded corners.
 - ry : float 
x-axis radius of the rectangle. Use it if you want rounded corners.
 - rotation : float 
Rotate the rectangle by the given amount of degrees clockwise around the center of the
rectangle.
 
▶ def sbox(self, **kwargs) -> Box  Shortcut for `box(height="fill")` if the layout is horizontal or `box(width="fill")` if the layout is vertical. 
 ▶ def text(self, text: str, style="default", *, ...) -> textboxitem.TextBoxItem  Draws text. 
 def text( 
self,
text: str,
style="default",
*,
escape_char="~",
scale_to_fit=False,
rotation: float = None,
 ) -> textboxitem.TextBoxItem 
 Parameters
- text : str 
Text content that will be drawn.
 - style : str | `textstyle.TextStyle` 
Name of a style or an instance of `textstyle.TextStyle` that will be used to style the
text.
 - escape_char : str 
Escape character for creating inline styles in the text.
 - scale_to_fit : 
If True, scales the text to fit its parent box.
 - rotation : float 
Rotate the text by the given amount of degrees clockwise around the center of the
text.
 
▷ def x(self, value) -> lazy.LazyValue  Create a lazy value relative to the left edge of the box. 
 ▷ def y(self, value) -> lazy.LazyValue  Create a lazy value relative to the top edge of the box. 
 
Subclasses
Reexports