SeleniumBase Presenter (slide-maker) lets you use Python to generate HTML presentations.
Here's a sample presentation:
[presenter.gif]
([Click on the image/GIF for the actual presentation](https://seleniumbase.io/other/presenter.html))
([Here's the code for that presentation](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/presenter/my_presentation.py))
Slides can include HTML, code, images, and iframes.
Here's how to run the example presentation:
```zsh
cd examples/presenter
pytest my_presentation.py
```
Here's a presentation with a chart:
[sb_core_areas.png]
([Click on the image/GIF for the actual presentation](https://seleniumbase.io/other/core_presentation.html))
([Here's the code for that presentation](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/presenter/core_presentation.py))
Here's how to run that example:
```zsh
cd examples/presenter
pytest core_presentation.py
```
[logo6.png] Creating a new presentation:
```python
self.create_presentation(name=None, theme="serif", transition="default")
""" Creates a Reveal-JS presentation that you can add slides to.
@Params
name - If creating multiple presentations at the same time,
use this to specify the name of the current presentation.
theme - Set a theme with a unique style for the presentation.
Valid themes: "serif" (default), "sky", "white", "black",
"simple", "league", "moon", "night",
"beige", "blood", and "solarized".
transition - Set a transition between slides.
Valid transitions: "none" (default), "slide", "fade",
"zoom", "convex", and "concave".
"""
```
If creating multiple presentations at the same time, you can pass the ``name`` parameter to distinguish between different presentations.
Notes are disabled by default. You can enable notes by specifying:
``show_notes=True``
[logo6.png] Adding a slide to a presentation:
```python
self.add_slide(content=None, image=None, code=None, iframe=None,
content2=None, notes=None, transition=None, name=None)
""" Allows the user to add slides to a presentation.
@Params
content - The HTML content to display on the presentation slide.
image - Attach an image (from a URL link) to the slide.
code - Attach code of any programming language to the slide.
Language-detection will be used to add syntax formatting.
iframe - Attach an iFrame (from a URL link) to the slide.
content2 - HTML content to display after adding an image or code.
notes - Additional notes to include with the slide.
ONLY SEEN if show_notes is set for the presentation.
transition - Set a transition between slides. (overrides previous)
Valid transitions: "none" (default), "slide", "fade",
"zoom", "convex", and "concave".
name - If creating multiple presentations at the same time,
use this to select the presentation to add slides to.
"""
```
[logo6.png] Running a presentation:
```python
self.begin_presentation(
filename="my_presentation.html", show_notes=False, interval=0)
""" Begin a Reveal-JS Presentation in the web browser.
@Params
name - If creating multiple presentations at the same time,
use this to select the one you wish to add slides to.
filename - The name of the HTML file that you wish to
save the presentation to. (filename must end in ".html")
show_notes - When set to True, the Notes feature becomes enabled,
which allows presenters to see notes next to slides.
interval - The delay time between autoplaying slides. (in seconds)
If set to 0 (default), autoplay is disabled.
"""
```
Before the presentation is run, the full HTML is saved to the ``saved_presentations/`` folder.
All methods have the optional ``name`` argument, which is only needed if you're creating multiple presentations at once.
[logo6.png] Here's an example of using SeleniumBase Presenter:
```python
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)
class MyPresenterClass(BaseCase):
def test_presenter(self):
self.create_presentation(theme="serif")
self.add_slide(
'Welcome
\n'
'Press the Right Arrow
')
self.add_slide(
'SeleniumBase Presenter
\n'
'
[logo3a.png]'
''
'
[python_3d_logo.png]'
'
\nCreate presentations with Python
')
self.add_slide(
'Make slides using HTML:
\n'
''
'\n\n'
'| Row ABC | Row XYZ |
\n'
''
'| Value ONE | Value TWO |
\n'
'\n'
'| Value THREE | Value FOUR |
\n'
'
\n(HTML table example)
')
self.add_slide(
'Keyboard Shortcuts:
\n'
'\n'
'| Key | Action |
\n'
'| => | Next Slide (N also works) |
\n'
'
|