GttDisplay

class gtt.GttDisplay(port: str)
__init__(port: str)
Parameters

port – a serial port like COM3 or /dev/ttyUSB0

create_plain_bar(bar_id: Union[int, str], value: int, max_value: int, x_pos: int, y_pos: int, width: int, height: int, min_value: int = 0, fg_color_hex='FFFFFF', bg_color_hex='000000', direction: gtt.enums.BarDirection = BarDirection.BOTTOM_TO_TOP)

Creates a bar graph which is really just a single bar.

Parameters
  • bar_id – This will be the unique ID used to refer to the bar in other methods. If a string is supplied, it will be mapped to an integer and the mapping will be stored in the instance.

  • value – the initial value of the bar graph. Should be between min_value and max_value inclusive

  • max_value – the maximum value which can be shown on the bar graph.

  • x_pos – the distance from the left edge of the screen in pixels

  • y_pos – the distance from the top edge of the screen in pixels

  • width – the width of the bar in pixels

  • height – the height of the bar in pixels

  • min_value – the minimum value which can be shown are the bar

  • fg_color_hex – a hex color string for the filled part of the bar

  • bg_color_hex – a hex color string for the unfilled part of the bar

  • direction – Describes how the bar will grow and shrink based on the current value

height: int

The height of this display in pixels

ids_in_use: Set[int]

This stores all the integer IDs of the components created by this GttDisplay instance. If you use a mix of string and integer IDs to refer to your components, you may want to check whether new integer IDs exist in this set before using them.

update_bar_value(bar_id: Union[int, str], value: int)

Sets the value of the bar given by bar_id to value which should be between it’s min and max values

width: int

The height of this display in pixels