Group Beampy modules to place them easily.
Grouping modules allows to create complex layout in your slide.
from beampy import *
# Remove quiet=True to get Beampy render outputs
doc = document(quiet=True)
with slide('Grouping elements'):
# Using with statement:
with group(y=0.1, background='lightblue', width='90%') as g1:
text("I'm inside the first group", y=0)
text('Me too!', y="+0.1")
# Create two groups (g2 and g4) aligned on top
# and with automatic horizontal position
with group(x='auto', y=0.3, width=400, height=200, background='lightgreen') as g2:
text('At the group center', x='center', y='center')
# Add child group to the parent group
with group(width='50%', background='red', x=g2.left+0, y=g2.bottom+bottom(0)) as g3:
text('A group in a group')
with group(width='50%', background='violet', x=g3.right+0, y=g3.top+0) as g3:
text('A group in a group')
with group(x='auto', y=g2.top+0, height=300, width=300) as g4:
text('''A last group with a bigger height and a lower width.
The text inside this group has the group width!''')
# Add a border to the last group
g4.add_border()
display_matplotlib(gcs())
beampy.
group
(elements_to_group=None, x=’center’, y=’auto’, width=None, height=None, background=None, parentid=None, parent_slide_id=None, opengroup=True)Group Beampy modules together and manipulate them as a group
Parameters: |
|
---|
Note
When the position of a group (x, y) are relative to a parent group and that the parent group has width`=None or `height`=None and positions `x or y equal to ‘auto’ or ‘center’, the render will use the slide.curwidth as width and the document._height as height. This will produce unexpected positioning of child group.