WhakerPy 0.8

https://sourceforge.net/projects/whakerpy/

Module whakerpy.htmlmaker

Class HTMLImage

Description

Represent an image element.

The set_attribute method should be overridden to check if the given key is in the list of accepted attributes.

Constructor

Create an image leaf node.

Parameters
  • parent: (str) Identifier of the parent node
  • identifier: (str | None) Identifier to assign to the image
  • src: (str) Image source relative path
View Source
def __init__(self, parent: str, identifier: str, src: str):
    """Create an image leaf node.

    :param parent: (str) Identifier of the parent node
    :param identifier: (str | None) Identifier to assign to the image
    :param src: (str) Image source relative path

    """
    super(HTMLImage, self).__init__(parent, identifier, 'img')
    self.add_attribute('src', src)
    self.add_attribute('alt', '')