Comics

Rendering of the comics example

Shows today’s Calvin and Hobbes strip under the date. It builds on date by adding an image widget, <gocomics>, which downloads the strip from GoComics each time the screen is rendered.

Files

  • comics.yml — the config. Re-renders the comics screen every morning at 06:00.

  • comics.xml.jinja — the screen template. <gocomics> scales the strip to fit the box between the date and the credit line. fillmode="preserveaspectstretch" makes both the wide weekday strips and the taller Sunday strips fill as much of the box as they can.

Changing the comic

Set identifier to the comic’s slug from its GoComics URL, e.g. garfield for https://www.gocomics.com/garfield. Also update the credit line to name the new comic and its artist. The strips belong to their creators, so keep the credit whenever you show one.

date picks which day’s strip to show. The template passes it from timestamp, so the day follows the config’s settings.timezone. Without it, <gocomics> uses today’s date on the server’s clock.

Try it

From the web/ directory:

CONFIG_DIR=examples/comics uv run todays_paper comics -o comics.png

Add -t 2026-09-20 to see a Sunday strip, which is taller and in color.

Source

comics.xml.jinja

<screen>
    <text align="center" y="30" size="50">{{ timestamp.strftime('%A %-d %B') }}</text>
    <gocomics
        identifier="calvinandhobbes"
        date="{{ timestamp.strftime('%Y-%m-%d') }}"
        x="{{ (width/2)|int }}"
        y="{{ (height/2)|int }}"
        width="{{ width - 80 }}"
        height="{{ height - 220 }}"
        fillmode="preserveaspectstretch"
        align="center"
        valign="middle"
    />
    <text align="center" y="{{ height - 50 }}" size="24" color="#555555">Calvin and Hobbes by Bill Watterson · via GoComics.com</text>
</screen>

comics.yml

# Shows today's Calvin and Hobbes strip. Builds on date by adding an image fetched from the web.

settings:
  # Decides which day's strip is shown, via the template's `timestamp`.
  timezone: Europe/Stockholm

screens:
  # Panel resolution. Use 1024x758 for an ED060XC3 panel, 1448x1072 for an ED060KC1 panel.
  width: 1024
  height: 758
  rotate: 0
  comics:
    template: comics.xml.jinja

scheduler:
  # New strips are published around midnight US time, so 06:00 in Europe picks up today's.
  - days: [1, 2, 3, 4, 5, 6, 7]
    hour: 6
    screen: comics