Web Analytics

beampy

⭐ 60 stars English by hchauvet

Beampy Build Status codecov pypi python version pypi licence pypi download pypi beampy version

The development of the master branch is currently frozen, (only urgent bug fix will be pushed), the new version of beampy is currently developped in the dev branch which is still not enouth stable to use...

Beampy is a python tool to create slide-show in svg that can be displayed with HTML5 (tested on Firefox and Chromium) The size of slides is fixed, like in a Latex Beamer document.

Beampy presentation output only one html file with every contents embedded.

See a Beampy tests presentation (source is in examples/beampy_tests_modules.py*)

Install:

From Python Package Index:

pip install beampy-slideshow

See full installation documentation

A quick example :

from beampy import *

doc = document()

with slide(): maketitle('Beampy a tool to make simple presentation', ['H. Chauvet'])

with slide('Beampy test'): text(r'\href{#0}{Go to Title}') text(r'Use LaTeX to render text and $$\sqrt{10}$$', align='center')

with slide('Beampy test with animated layers'): text(r'\href{#0}{Go to Title}')[:] text(r'Use LaTeX to render text and $$\sqrt{10}$$', align='center')[1]

save('./simple_one.html')

#To save in pdf just change the above command to the following #save('./simple_one.pdf')

beampy_presentation.html

Change log:

0.5.5

(seed issue #18 for the whole story), which creates missing part of latex stuff in the svg.

0.5.4

0.5.3

Some minor fixes:

0.5.2

an option to write the svg produced by dvisvgm). "extra_packages" argument. speed (no need to call Inkscape). operations like: ``python

# 50% of the currentwidth a = rectangle(width='50%', height=10)

# width/height relative to the a element b = rectangle(width=a.width/2+'2cm', height=a.height/'10pt') `

`python

a = rectangle(width='50%', height=10)

b = rectangle(x=a.width+'2cm', y=a.height+5) `

operation on position or length (i.e. when you make an operation on an element width or height that is unknown, the element will be rendered to get its size and allow the operation)
  • Add "zorder" operation for modules (above/below/last/first) to change
their overlay order:

`python

a = rectangle(x='center', y='center', width=50, height=50) b = rectangle(x='center', y='center', width=a.height+100, height=a.height+100, color='red')

# Make b appears below a b.below(a) # equivalent to a.above(b) or a.last() or b.first() `

0.5.1

0.5.0

  • Add box function to decorate group
  • New experimental way to write text inside presentation using context manager
`python with text(width=400): """ Any comment inside the context manager will be passed to the text function as input argument. This allows clearer source when writing long texts.

No more need to add an r before to protect the text passed to latex, it's now automatically added. """ `

0.4.9

bounding-box of module to place them.
  • Add utils.py to store functions that call beampy modules.
  • Add function bounding_box(module) to utils.py to draw bounding box with
anchors around Beampy modules. Add also a function to draw axes on slide, draw_axes()

0.4.8

  • Partially fix issue #12.
  • Clean code syntax.

0.4.7

  • Introduce layer mechanism. Slide elements can be animated by layers allowing mechanism like beamer "\only".
The layers are managed as python slicing on Beampy modules.

`python with slide('Test layers'): text('First printed on layer 0') text('Secondly printed on layer 1')[1] text('Printed from layer 2 to 3')[2,3] text('Printed on all layers')[:] text('Printed on layer 4')[4] with group(width=300)[2:]: text('Printed inside group') text('for layers 2 to end') `

0.4.6

`python with group(): text('toto') with group(width=300): text('tata')

with group(width=200): figure('./niceplot.pdf') text('nice legend') `

`python with group(width=200): figure('./niceplot.pdf') text('nice legend') # Figure and text width will be automatically set to 200 px `

  • Relative placement can now be done on auto-positioned elements
`python t0 = text('toto') text('tata', x=t0.center + center(0), t0.bottom + 0.1) `

Video now could use external links (with embedded=True*) rather than be included in the html file. The video is loaded from disk (be careful with file path) when the slide is displayed on screen.

0.4.5

  • All texts are preprocessed in a single latex file (Latex is called only once: improve compilation time)
  • Cache bug fix: Video and svg are now cached correctly

0.4.4

  • Improve cache: one file per element cached (don't write the cache twice!)
  • Svg: Add line and rectangle commands to easily draw lines and rectangles
  • Relative placement: add shortcut center(shift), right(shift) and bottom(shift)
to change the anchor of the current element.
`python e1 = text('Somthing', x=0.2, y=0.4) e2 = text('An other thing', x=e1.left + right(0.1), y=e1.center + center(0)) ``

0.4.3

Matplotlib figures can now be directly passed to figure() or a list of matplotlib figures can be animated with animatesvg()*

0.4.2

Add svg* command to include raw svg in slide

0.4.1

to modules in order to create their chache id

Installation

See Beampy documentation install page

--- Tranlated By Open Ai Tx | Last indexed: 2026-06-05 ---