disp_textT_disp_textDispTextDispTextdisp_text (Operator)

Name

disp_textT_disp_textDispTextDispTextdisp_text — Display text in a window.

Signature

disp_text( : : WindowHandle, String, CoordSystem, Row, Column, Color, GenParamName, GenParamValue : )

Herror T_disp_text(const Htuple WindowHandle, const Htuple String, const Htuple CoordSystem, const Htuple Row, const Htuple Column, const Htuple Color, const Htuple GenParamName, const Htuple GenParamValue)

void DispText(const HTuple& WindowHandle, const HTuple& String, const HTuple& CoordSystem, const HTuple& Row, const HTuple& Column, const HTuple& Color, const HTuple& GenParamName, const HTuple& GenParamValue)

void HWindow::DispText(const HTuple& String, const HString& CoordSystem, const HTuple& Row, const HTuple& Column, const HTuple& Color, const HTuple& GenParamName, const HTuple& GenParamValue) const

void HWindow::DispText(const HString& String, const HString& CoordSystem, Hlong Row, Hlong Column, const HString& Color, const HTuple& GenParamName, const HTuple& GenParamValue) const

void HWindow::DispText(const char* String, const char* CoordSystem, Hlong Row, Hlong Column, const char* Color, const HTuple& GenParamName, const HTuple& GenParamValue) const

void HWindow::DispText(const wchar_t* String, const wchar_t* CoordSystem, Hlong Row, Hlong Column, const wchar_t* Color, const HTuple& GenParamName, const HTuple& GenParamValue) const   (Windows only)

static void HOperatorSet.DispText(HTuple windowHandle, HTuple stringVal, HTuple coordSystem, HTuple row, HTuple column, HTuple color, HTuple genParamName, HTuple genParamValue)

void HWindow.DispText(HTuple stringVal, string coordSystem, HTuple row, HTuple column, HTuple color, HTuple genParamName, HTuple genParamValue)

void HWindow.DispText(string stringVal, string coordSystem, int row, int column, string color, HTuple genParamName, HTuple genParamValue)

def disp_text(window_handle: HHandle, string: MaybeSequence[str], coord_system: str, row: MaybeSequence[Union[int, float, str]], column: MaybeSequence[Union[int, float, str]], color: MaybeSequence[str], gen_param_name: Sequence[str], gen_param_value: Sequence[Union[str, int, float]]) -> None

Description

disp_textdisp_textDispTextDispTextDispTextdisp_text displays text in the graphics window WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle at the position (RowRowRowRowrowrow,ColumnColumnColumnColumncolumncolumn).

If only a single position is defined, one text line is displayed for each element of StringStringStringStringstringValstring. Also, '\n'"\n""\n""\n""\n""\n" will be interpreted as a newline character, i.e., a line break is performed.

If multiple positions are defined, only a single string or one string for each position is allowed in StringStringStringStringstringValstring. In this case, line breaks have to be forced with '\n'"\n""\n""\n""\n""\n".

Newlines ('\n'"\n""\n""\n""\n""\n") at the end of StringStringStringStringstringValstring are ignored.

The position of the text may be specified in window coordinates (CoordSystemCoordSystemCoordSystemCoordSystemcoordSystemcoord_system = 'window'"window""window""window""window""window") or in image coordinates (CoordSystemCoordSystemCoordSystemCoordSystemcoordSystemcoord_system = 'image'"image""image""image""image""image"), which is useful when using zoomed images.

In addition to supplying (RowRowRowRowrowrow,ColumnColumnColumnColumncolumncolumn) coordinates, it is also possible to pass predefined values to RowRowRowRowrowrow and ColumnColumnColumnColumncolumncolumn to display the text at a fixed Position in the window (only if CoordSystemCoordSystemCoordSystemCoordSystemcoordSystemcoord_system = 'window'"window""window""window""window""window").:

'top'"top""top""top""top""top", 'left'"left""left""left""left""left" 'top'"top""top""top""top""top", 'center'"center""center""center""center""center" 'top'"top""top""top""top""top", 'right'"right""right""right""right""right"
'center'"center""center""center""center""center", 'left'"left""left""left""left""left" 'center'"center""center""center""center""center", 'center'"center""center""center""center""center" 'center'"center""center""center""center""center", 'right'"right""right""right""right""right"
'bottom'"bottom""bottom""bottom""bottom""bottom", 'left'"left""left""left""left""left" 'bottom'"bottom""bottom""bottom""bottom""bottom", 'center'"center""center""center""center""center" 'bottom'"bottom""bottom""bottom""bottom""bottom", 'right'"right""right""right""right""right"

The parameter ColorColorColorColorcolorcolor also accepts tuples of values. In that case, the specified colors are used cyclically for every new text position or for every new text line if a single position is used.

Generic Parameters

disp_textdisp_textDispTextDispTextDispTextdisp_text may display the StringStringStringStringstringValstring within a box (default). This behavior and the look of the box are defined with the generic parameters in GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value.

'box'

If 'box'"box""box""box""box""box" is set to 'true'"true""true""true""true""true", the text is written within a box. The look of the box and its optional shadow can be configured with the generic parameters below.

possible values: 'true'"true""true""true""true""true" and 'false'"false""false""false""false""false"

default value: 'true'"true""true""true""true""true"

'box_color'

Sets the color of the box.

possible values: a string containing the color name (e.g., 'white'"white""white""white""white""white", 'red'"red""red""red""red""red", or '#aa00bba0'"#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0")

default value: '#fce9d4'"#fce9d4""#fce9d4""#fce9d4""#fce9d4""#fce9d4" (which is a light orange)

'shadow'

If 'shadow'"shadow""shadow""shadow""shadow""shadow" is set to 'true'"true""true""true""true""true", an additional shadow is displayed beneath the box (if 'box'"box""box""box""box""box" is 'true'"true""true""true""true""true").

possible values: 'true'"true""true""true""true""true" and 'false'"false""false""false""false""false"

default value: 'true'"true""true""true""true""true" if 'box_color'"box_color""box_color""box_color""box_color""box_color" is set to a color without alpha value, 'false'"false""false""false""false""false" otherwise

'shadow_color'

Sets the color of the shadow if 'shadow'"shadow""shadow""shadow""shadow""shadow" is 'true'"true""true""true""true""true".

possible values: a string containing the color name (e.g., 'black'"black""black""black""black""black", 'red'"red""red""red""red""red", or '#aa00bba0'"#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0")

default value: '#f28d26'"#f28d26""#f28d26""#f28d26""#f28d26""#f28d26" (which is a darker orange) if 'box_color'"box_color""box_color""box_color""box_color""box_color" is not set, 'white'"white""white""white""white""white" otherwise

'border_radius'

Controls the roundness of the box's corners. For sharp corners set it to 0, for smoother corners to higher values.

possible values: positive real numbers or 0

default value: 2

'box_padding'

Controls to which amount in pixels the box is extended around the text.

possible values: positive real number

default value: 0

'shadow_sigma'

Controls to which amount the shadow beneath the box is blurred. Set it to 0 for a sharp shadow.

possible values: positive real number or 0

default value: 1.5

'shadow_dx' and 'shadow_dy'

Controls the offset of the shadow in column ('shadow_dx'"shadow_dx""shadow_dx""shadow_dx""shadow_dx""shadow_dx") and row ('shadow_dy'"shadow_dy""shadow_dy""shadow_dy""shadow_dy""shadow_dy") direction in pixels.

possible values: any real number

default_value: 2

Attention

disp_textdisp_textDispTextDispTextDispTextdisp_text depends on the library libcanvas, which might not be available on embedded systems.

Execution Information

Parameters

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle (input_control)  window HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Window handle.

StringStringStringStringstringValstring (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

A tuple of strings containing the text message to be displayed. Each value of the tuple will be displayed in a single line.

Default value: 'hello' "hello" "hello" "hello" "hello" "hello"

CoordSystemCoordSystemCoordSystemCoordSystemcoordSystemcoord_system (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

If set to 'window', the text position is given with respect to the window coordinate system. If set to 'image', image coordinates are used (this may be useful in zoomed images).

Default value: 'window' "window" "window" "window" "window" "window"

List of values: 'image'"image""image""image""image""image", 'window'"window""window""window""window""window"

RowRowRowRowrowrow (input_control)  point.y(-array) HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

The vertical text alignment or the row coordinate of the desired text position.

Default value: 12

List of values: 12, 'bottom'"bottom""bottom""bottom""bottom""bottom", 'center'"center""center""center""center""center", 'top'"top""top""top""top""top"

ColumnColumnColumnColumncolumncolumn (input_control)  point.x(-array) HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

The horizontal text alignment or the column coordinate of the desired text position.

Default value: 12

List of values: 12, 'center'"center""center""center""center""center", 'left'"left""left""left""left""left", 'right'"right""right""right""right""right"

ColorColorColorColorcolorcolor (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

A tuple of strings defining the colors of the texts.

Default value: 'black' "black" "black" "black" "black" "black"

List of values: 'black'"black""black""black""black""black", 'blue'"blue""blue""blue""blue""blue", 'coral'"coral""coral""coral""coral""coral", 'cyan'"cyan""cyan""cyan""cyan""cyan", 'forest green'"forest green""forest green""forest green""forest green""forest green", 'green'"green""green""green""green""green", 'lime green'"lime green""lime green""lime green""lime green""lime green", 'magenta'"magenta""magenta""magenta""magenta""magenta", 'red'"red""red""red""red""red", 'slate blue'"slate blue""slate blue""slate blue""slate blue""slate blue", 'yellow'"yellow""yellow""yellow""yellow""yellow"

GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (input_control)  attribute.name-array HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Generic parameter names.

Default value: []

List of values: 'border_radius'"border_radius""border_radius""border_radius""border_radius""border_radius", 'box'"box""box""box""box""box", 'box_color'"box_color""box_color""box_color""box_color""box_color", 'box_padding'"box_padding""box_padding""box_padding""box_padding""box_padding", 'shadow'"shadow""shadow""shadow""shadow""shadow", 'shadow_color'"shadow_color""shadow_color""shadow_color""shadow_color""shadow_color", 'shadow_dx'"shadow_dx""shadow_dx""shadow_dx""shadow_dx""shadow_dx", 'shadow_dy'"shadow_dy""shadow_dy""shadow_dy""shadow_dy""shadow_dy", 'shadow_sigma'"shadow_sigma""shadow_sigma""shadow_sigma""shadow_sigma""shadow_sigma"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (input_control)  attribute.value-array HTupleSequence[Union[str, int, float]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Generic parameter values.

Default value: []

List of values: 5.0, 'black'"black""black""black""black""black", 'blue'"blue""blue""blue""blue""blue", 'false'"false""false""false""false""false", 'forest green'"forest green""forest green""forest green""forest green""forest green", 'red'"red""red""red""red""red", 'true'"true""true""true""true""true", 'white'"white""white""white""white""white"

Example (HDevelop)

dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
disp_text (WindowHandle, 'Display some text in a box', 'window', 12, 12, \
           'black', [], [])

Possible Predecessors

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window, set_fontset_fontSetFontSetFontSetFontset_font, get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtentsget_string_extents

Alternatives

write_stringwrite_stringWriteStringWriteStringWriteStringwrite_string

See also

get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtentsget_string_extents, set_fontset_fontSetFontSetFontSetFontset_font

Module

Foundation