write_stringT_write_stringWriteStringWriteStringwrite_string (算子)
名称
write_stringT_write_stringWriteStringWriteStringwrite_string — 在窗口中打印文本。
签名
def write_string(window_handle: HHandle, string: MaybeSequence[Union[int, float, str]]) -> None
描述
write_stringwrite_stringWriteStringWriteStringWriteStringwrite_string prints StringStringStringStringstringValstring in the output
window starting at the current cursor position. The output text has to fit
within the right window boundary (the width of the string can be queried
by get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtentsget_string_extents).
The font currently assigned to the window will used. The text cursor is
positioned at the end of the text.
write_stringwrite_stringWriteStringWriteStringWriteStringwrite_string can output all three types of data used in HALCON .
The conversion to a string is guided by the following rules:
-
strings are not converted.
-
integer numbers are converted without any spaces before or
after the number.
-
floating numbers are printed (if possible) with a floating point
and without an exponent.
-
the resulting strings are concatenated without spaces.
For buffering of texts see set_systemset_systemSetSystemSetSystemSetSystemset_system with the flag
'flush_graphic'.
注意
If clipping at the window boundary is desired, exceptions can be switched
off by set_check(::'~text':)set_check("~text")SetCheck("~text")SetCheck("~text")SetCheck("~text")set_check("~text")。
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle (输入控制) window → HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
窗口句柄。
StringStringStringStringstringValstring (输入控制) string(-array) → HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)
Tuple of output values (all types).
默认值:
'hello'
"hello"
"hello"
"hello"
"hello"
"hello"
结果
write_stringwrite_stringWriteStringWriteStringWriteStringwrite_string returns 2 (
H_MSG_TRUE)
if the window is valid and the
output text fits within the current line (see set_checkset_checkSetCheckSetCheckSetCheckset_check).否则将抛出异常。
可能的前趋
open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window,
set_fontset_fontSetFontSetFontSetFontset_font,
get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtentsget_string_extents
替代
fwrite_stringfwrite_stringFwriteStringFwriteStringFwriteStringfwrite_string
另见
set_tpositionset_tpositionSetTpositionSetTpositionSetTpositionset_tposition,
get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtentsget_string_extents,
set_fontset_fontSetFontSetFontSetFontset_font,
set_systemset_systemSetSystemSetSystemSetSystemset_system,
set_checkset_checkSetCheckSetCheckSetCheckset_check
模块
基础