Forms
- class Forms(name='Simple UI', ok=True, cancel=True, width=- 1, height=- 1)
A class to create customizable forms.
Opens a new window with a forms layout.
- Parameters
name (str) -- The title of the window that will be displayed in the top left corner.
ok (bool) -- If
True
an Ok button will be displayed in the bottom of the window.cancel (bool) -- If
True
a Cancel button will be displayed in the bottom of the window.width (int) -- The width of the window.
height (int) -- The height of the window.
- property values
Contains the values for the added widgets. The key is the name of the widget passed in methods.
For a text input, the value in the dictionary will be the text in the input.
For a check box, if it is checked the value will be
True
else it will beFalse
.For a combobox, the value will be the text of the currently selected item.
For radio button groups, the value will be the label of the selected radio.
- show()
Displays the window on screen.
- Returns
Whether the Ok Button was clicked or not.
- Return type
- start_group(label=None)
Starts a group of widgets. Widgets added between
start_group()
andend_group()
are added to a frame with a name.end_group()
must be called at the end of the group.
- end_group()
Ends a group started with
start_group()
.
- add_button(text='', action=None, pos=Position.LEFT)
Add a button to the window.
- add_check_box(name, label=None, state=False, pos=Position.LEFT)
Add a checkbox to the window.
- Parameters
- Returns
The checkbox that was created and added to the window.
- Return type
- Raises
RuntimeError -- If the name is already used for another widget in the form.
- add_combo_box(name, label=None, items=[])
Add a combobox to the window.
- Parameters
- Returns
The combobox that was created and added to the window.
- Return type
- Raises
RuntimeError -- If the name is already used for another widget in the form.
- add_list_box(name, label=None, items=[])
Add a listbox to the window.
- Parameters
- Returns
The listbox that was created and added to the window.
- Return type
- Raises
RuntimeError -- If the name is already used for another widget in the form.
- add_radio_button_group(name, label=None, items=[])
Add a group composed of radio buttons to the window.
- Parameters
- Returns
The radio buttons that were created and added to the window.
- Return type
- Raises
RuntimeError -- If the name is already used for another widget in the form.
- add_separator()
Add an horizontal separator on the window.
- add_text(text='', pos=Position.Left)
Displays a text on the window.
- add_text_input(name, label=None, text='')
Add a text input to the window.
- Parameters
- Returns
The text input that was created and added to the window.
- Return type
- Raises
RuntimeError -- If the name is already used for another widget in the form.
- add_open_file_selector(name, label=None, filter='', dir='/')
Add an open file selector to the window.
- Parameters
- Raises
RuntimeError -- If the name is already used for another widget in the form.
- add_open_folder_selector(name, label=None, filter='', dir='/')
Add an open directory selector to the window.
- Parameters
- Raises
RuntimeError -- If the name is already used for another widget in the form.
- add_save_file_selector(name, label=None, filter='', dir='/')
Add a save file selector to the window.
- Parameters
- Raises
RuntimeError -- If the name is already used for another widget in the form.