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_textDispTextDispTextdisp_text displays text in the graphics window WindowHandleWindowHandleWindowHandlewindowHandlewindow_handle at the position (RowRowRowrowrow,ColumnColumnColumncolumncolumn).

If only a single position is defined, one text line is displayed for each element of StringStringStringstringValstring. Also, '\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 StringStringStringstringValstring. In this case, line breaks have to be forced with '\n'"\n""\n""\n""\n".

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

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

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

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

The parameter ColorColorColorcolorcolor 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_textDispTextDispTextdisp_text may display the StringStringStringstringValstring within a box (default). This behavior and the look of the box are defined with the generic parameters in GenParamNameGenParamNameGenParamNamegenParamNamegen_param_name and GenParamValueGenParamValueGenParamValuegenParamValuegen_param_value.

'box'

If 'box'"box""box""box""box" is set to '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.

List of values: 'true'"true""true""true""true" and 'false'"false""false""false""false"

Default: 'true'"true""true""true""true"

'box_color'

Sets the color of the box.

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

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

'shadow'

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

List of values: 'true'"true""true""true""true" and 'false'"false""false""false""false"

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

'shadow_color'

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

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

Default: '#f28d26'"#f28d26""#f28d26""#f28d26""#f28d26" (which is a darker orange) if 'box_color'"box_color""box_color""box_color""box_color" is not set, '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.

List of values: positive real numbers or 0

Default: 2

'box_padding'

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

List of values: positive real number

Default: 0

'shadow_sigma'

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

List of values: positive real number or 0

Default: 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") and row ('shadow_dy'"shadow_dy""shadow_dy""shadow_dy""shadow_dy") direction in pixels.

List of values: any real number

Default: 2

'backdrop_blur_sigma'

Controls to which amount the background of the box is blurred. s only an effect if 'box'"box""box""box""box" is 'true'"true""true""true""true" and 'box_color'"box_color""box_color""box_color""box_color" is not opaque (i.e. alpha is not 255). It is recommended to use 'backdrop_blur_sigma'"backdrop_blur_sigma""backdrop_blur_sigma""backdrop_blur_sigma""backdrop_blur_sigma" with 'shadow'"shadow""shadow""shadow""shadow" set to 'false'"false""false""false""false".

List of values: positive real number or 0

Default: 0

'rotate_phi'

Angle in degrees to rotate the displayed text.

List of values: any real number

Default: 0

'rotate_col'

Column coordinate of the rotation center if 'rotate_phi'"rotate_phi""rotate_phi""rotate_phi""rotate_phi" is different to zero. Choose either a column coordinate by setting a real number or determine the rotation center on the left edge ('text_left'"text_left""text_left""text_left""text_left"), the right edge ('text_right'"text_right""text_right""text_right""text_right"), or in the center ('text_center'"text_center""text_center""text_center""text_center") of the text box.

List of values: any real number or 'text_left'"text_left""text_left""text_left""text_left", 'text_center'"text_center""text_center""text_center""text_center", 'text_right'"text_right""text_right""text_right""text_right"

Default: 'text_center'"text_center""text_center""text_center""text_center"

'rotate_row'

Row coordinate of the rotation center if 'rotate_phi'"rotate_phi""rotate_phi""rotate_phi""rotate_phi" is different to zero. Choose either a row coordinate by setting a real number or determine the rotation center on the top edge ('text_top'"text_top""text_top""text_top""text_top"), the bottom edge ('text_bottom'"text_bottom""text_bottom""text_bottom""text_bottom"), or in the center ('text_center'"text_center""text_center""text_center""text_center") of the text box.

List of values: any real number or 'text_top'"text_top""text_top""text_top""text_top", 'text_center'"text_center""text_center""text_center""text_center", 'text_bottom'"text_bottom""text_bottom""text_bottom""text_bottom"

Default: 'text_center'"text_center""text_center""text_center""text_center"

'border_color'

Sets the color of the border of the text box.

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

Default: '#ffffff'"#ffffff""#ffffff""#ffffff""#ffffff"

'border_width'

Controls the width of the text box border.

List of values: positive real numbers or 0

Default: 0

Attention

disp_textdisp_textDispTextDispTextdisp_text depends on the library libhcanvas, which might not be available on embedded systems.

Execution Information

Parameters

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

Window handle.

StringStringStringstringValstring (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: 'hello' "hello" "hello" "hello" "hello"

CoordSystemCoordSystemCoordSystemcoordSystemcoord_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: 'window' "window" "window" "window" "window"

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

RowRowRowrowrow (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: 12

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

ColumnColumnColumncolumncolumn (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: 12

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

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

A tuple of strings defining the colors of the texts.

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

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

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

Generic parameter names.

Default: []

List of values: 'backdrop_blur_sigma'"backdrop_blur_sigma""backdrop_blur_sigma""backdrop_blur_sigma""backdrop_blur_sigma", 'border_color'"border_color""border_color""border_color""border_color", 'border_radius'"border_radius""border_radius""border_radius""border_radius", 'border_width'"border_width""border_width""border_width""border_width", 'box'"box""box""box""box", 'box_color'"box_color""box_color""box_color""box_color", 'box_padding'"box_padding""box_padding""box_padding""box_padding", 'rotate_col'"rotate_col""rotate_col""rotate_col""rotate_col", 'rotate_phi'"rotate_phi""rotate_phi""rotate_phi""rotate_phi", 'rotate_row'"rotate_row""rotate_row""rotate_row""rotate_row", 'shadow'"shadow""shadow""shadow""shadow", 'shadow_color'"shadow_color""shadow_color""shadow_color""shadow_color", 'shadow_dx'"shadow_dx""shadow_dx""shadow_dx""shadow_dx", 'shadow_dy'"shadow_dy""shadow_dy""shadow_dy""shadow_dy", 'shadow_sigma'"shadow_sigma""shadow_sigma""shadow_sigma""shadow_sigma"

GenParamValueGenParamValueGenParamValuegenParamValuegen_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: []

List of values: 5.0, 'black'"black""black""black""black", 'blue'"blue""blue""blue""blue", 'false'"false""false""false""false", 'forest green'"forest green""forest green""forest green""forest green", 'red'"red""red""red""red", 'true'"true""true""true""true", '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_windowOpenWindowOpenWindowopen_window, set_fontset_fontSetFontSetFontset_font, get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsget_string_extents

Alternatives

write_stringwrite_stringWriteStringWriteStringwrite_string

See also

get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsget_string_extents, set_fontset_fontSetFontSetFontset_font

Module

Foundation