Graphics Programming (Processing Mode)

Processing Board

class miniworldmaker.boards.processing_board.ProcessingBoard(width=400, height=300)[source]

A ProcessingBoard

Parameters
  • width – The width of the board in Pixels (default: 400)

  • height – The height of the board in pixels (default: 300)

Shapes

class miniworldmaker.tokens.shapes.Point(position=None, thickness: int = 1, color: tuple = (255, 255, 255, 255))[source]

A Point-Shape

Parameters
  • position – The position as 2-tuple

  • thickness – The thickness of the point (1: pixel, >1: The point is rendered as circle)

  • color – The color as 4-tuple (r, g, b, alpha)

Examples

Creates a red point at position (200,100):

>>> Point((200, 100), 1, color=(255,0,0,255))
class miniworldmaker.tokens.shapes.Line(start_position: tuple, end_position: tuple, thickness: int = 1, color: tuple = (255, 255, 255, 255))[source]

A Line-Shape.

Parameters
  • start_position – The start_position as 2-tuple.

  • end_position – The end_position as 2-tuple.

  • thickness – The thickness of the bounding line

  • color – The color as 4-tuple (r, g, b, alpha)

Examples

Example Creation of a line

>>> Line((200, 100), (400,100), 1, color=(255,0,0,255))
Creates a line from (200, 100) to (400, 100)
class miniworldmaker.tokens.shapes.Circle(position=None, radius: int = 10, thickness: int = 1, color: tuple = (255, 255, 255, 255))[source]

A Circle-Shape.

Parameters
  • position – The position as 2-tuple. The circle is created with its center at the position

  • radius – The radius of the circle

  • thickness – The thickness of the bounding line (0: The object is filled)

  • color – The color as 4-tuple (r, g, b, alpha)

Examples

Example Creation of a circle

>>> Circle((200, 100), 20, 1, color=(255,0,0,255))
Creates a red circle at position (200,100) with radius 20

Example Creation of a filled circle

>>> Circle((200, 100), 20, 0, color=(255,0,0,255))
Creates a red circle at position (200,100) with radius 20. The circle is filled
radius

Gets the radius of the circle. If you change the circle-size (e.g. with self.size = (x, y), the radius value will be changed too.

Returns: The radius

class miniworldmaker.tokens.shapes.Ellipse(position=None, width=20, height=20, thickness: int = 1, color: tuple = (255, 255, 255, 255))[source]

An Ellipse-Shape.

Parameters
  • position – The position as 2-tuple. The circle is created with its center at the position

  • width – The width of the ellipse

  • height – The height of the ellipse

  • thickness – The thickness of the bounding line (0: The object is filled)

  • color – The color as 4-tuple (r, g, b, alpha)

Examples

Example Creation of an ellipse

>>> Circle((200, 100), 20, 40, 1, color=(255,0,0,255))
Creates an red ellise at position (200,100) with width 20 and height 40

Example Creation of a filled ellipse

>>> Circle((200, 100), 20, 40, 0, color=(255,0,0,255))
Creates a red circle at position (200,100) with width 20 and height 40. The ellipse is filled
height

Gets the height of the ellipse If you change the ellipse-size (e.g. with self.size = (x, y), the value will be changed too.

Returns: The height of the ellipse

width

Gets the width of the ellipse If you change the ellipse-size (e.g. with self.size = (x, y), the value will be changed too.

Returns: The width of the ellipse

class miniworldmaker.tokens.shapes.Polygon(pointlist, thickness=1, color: tuple = (255, 255, 255, 255))[source]

A Polygon-Shape.

Parameters
  • point-list – A list of points

  • thickness – The thickness of the bounding line

  • color – The color as 4-tuple (r, g, b, alpha)

Examples

Example Creation of a polygon

>>> Polygon([(200, 100), (400,100), (0, 0)], 1, color=(255,0,0,255))
Creates a red polygon with the vertices (200, 100) , (400, 100) and (0, 0)

Example Creation of a filled polygon

>>> Polygon([(200, 100), (400,100), (0, 0)], 0, color=(255,0,0,255))
Creates a red polygon with the vertices (200, 100) , (400, 100) and (0, 0)