Class Input
Input Box
For inputting text and passwords.
from ooodev.dialog.input import Input
pwd = Input.get_input(title="Password", msg="Input Password:", is_password=True)
print(pwd)
- class ooodev.dialog.input.Input[source]
- static get_input(title, msg, input_value='', ok_lbl='OK', cancel_lbl='Cancel', is_password=False)[source]
Displays an input box and returns the results.
Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.
- Parameters:
title (str) – Title for the dialog
msg (str) – Message to display such as “Input your Name”
input_value (str, optional) – Value of input box when first displayed.
ok_lbl (str, optional) – OK button Label. Defaults to “OK”.
cancel_lbl (str, optional) – Cancel Button Label. Defaults to “Cancel”.
is_password (bool, optional) – Determines if the input box is masked for password input. Defaults to
False
.
- Raises:
CancelEventError – If the dialog creation was cancelled.
- Returns:
The value of input or empty string.
- Return type:
str
Note
Raises a global event
GblNamedEvent.INPUT_BOX_CREATING
before creating the dialog. The event args are of typeCancelEventArgs
. Theevent_data
is a dictionary that contains the following key:msg
: The message to display.title
: The title of the dialog.input_value
: The value of the input box when first displayed.ok_lbl
: The label for the OK button.cancel_lbl
: The label for the Cancel button.is_password
: Determines if the input box is masked for password input.frame
: The frame of the dialog. If not set, the frame of the current document is used.
The default
frame
isNone
. If set value must be aXFrame
object.If the event is cancelled, the
result
value ofevent_data` if set will be returned. Otherwise if the event is not handled, a ``CancelEventError
is raised.