Documentation versions

Module reahl.web.holder.holder

New in version 3.2.

Generate images on the fly.

PlaceholderImage

class reahl.web.holder.holder.PlaceholderImage(view, x, y, alt=None, text=None, theme=None)

A PlaceholderImage is an image generated on the client browser using SVG.

Parameters:
  • view – (See Widget)
  • x – The width of the image (defaults to pixels, can be a string using CSS notation).
  • y – The height of the image (defaults to pixels, can be a string using CSS notation).
  • alt – Text to be displayed when the browser cannot handle images.
  • text – Text to be generated on the image itself.
  • theme – A PredefinedTheme or CustomTheme to control what the image should look like.

PredefinedTheme

class reahl.web.holder.holder.PredefinedTheme(theme_name)

There are a few named, PredefinedThemes you can choose from to control the look of a PlaceholderImage .

Parameters:theme_name – One of: ‘sky’, ‘vine’, ‘lava’, ‘gray’, ‘industrial’, or ‘social’.

CustomTheme

class reahl.web.holder.holder.CustomTheme(bg=None, fg=None, text_size=None, text_font=None, text_align=None, line_wrap=None, outline=None)

A CustomTheme allows one to control all the details of what a PlaceholderImage should look like.

Parameters:
  • bg – The background-colour (a string in CSS notation)
  • fg – The foreground-colour (a string in CSS notation)
  • text_size – The size of generated text (an int, denoted in pts)
  • text_font – The name of the font to use for generated text.
  • text_align – How to align the generated text (one of ‘left’ or ‘right’)
  • line_wrap – A ratio (line length to image width) at which generated text should wrap.
  • outline – Draws a border and diagonals in the image.

Documentation versions