======= Widgets ======= .. py:currentmodule:: p3dsdk.ui .. py:class:: Widget Base class of all widgets. .. py:property:: x The X coordinate of the label. :type: int .. py:property:: y The Y coordinate of the label. :type: int .. py:property:: width The width of the label. :type: int .. py:property:: height The height of the label. :type: int .. py:class:: Button(parent = None, text = "") Base class: :py:class:`Widget` When clicked, pressed, or released the corresponding function is called. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param text: The text that will be displayed on the button. :type text: str .. py:property:: text The text of the button. :type: str .. py:property:: on_click The function that will be called when the button is clicked. :type: Callable[[None], None] .. py:property:: on_press The function that will be called when the button is pressed. :type: Callable[[None], None] .. py:property:: on_release The function that will be called when the button is released. :type: Callable[[None], None] .. py:class:: CheckBox(parent = None, text = "") Base class: :py:class:`Widget` A check box with a text label on the left. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param text: The text on left of the CheckBox. :type text: str .. py:property:: checked Whether the checkBox is checked or not. :type: bool .. py:property:: text The text of the checkBox. :type: str .. py:property:: on_toggle The function that is called when the check box is toggled. :type: Callable[[bool], None] .. py:class:: ComboBox(parent = None, items = []) Base class: :py:class:`Widget` A comboBox with an unlimited number of items. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param items: The list of the names of all the items of the comboBox. :type items: list(str) .. py:property:: current_text The current item of the comboBox. :type: str .. py:property:: on_current_text_changed The function that is called when the comboBox current item changes. :type: Callable[[str], None] .. py:method:: add_item(item) Add an item. :param item: The name of the new item. :type item: str .. py:method:: add_items(items) Add a list of items. :param items: The list of the names of the new items of the comboBox. :type items: list(str) .. py:method:: insert_item(index, text) Insert an item in the comboBox :param index: The index in the list of items where the new item will be inserted. :type index: int :param text: The name of the new item. :type text: str .. py:class:: Label(parent = None, text = "") Base class: :py:class:`Widget` A Widget which contains text. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param text: The text of the label. :type text: str .. py:property:: text The text of the label. :type: str .. py:method:: adjust_size() Adjust the size of the label with the size of the text. .. py:class:: LineEdit(parent = None, text = "") Base class: :py:class:`Widget` A single-line text input. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param text: The text in the LineEdit. :type text: str .. py:property:: text The text of the LineEdit. :type: str .. py:property:: on_text_changed The function that will be called when the text of the LineEdit changes. :type: Callable[[str], None] .. py:property:: on_selection_changed "The function that will be called when the text selection is changed. :type: Callable[[None], None] .. py:method:: adjust_size() Adjust the size of the LineEdit with the size of the text. .. py:class:: ListBox(parent = None, items = []) Base class: :py:class:`Widget` A ListBox with several items in it which are selectable. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param items: The texts of the items in the ListBox. :type items: list(str) .. py:property:: current_item The text of the current selected item. :type: str .. py:method:: insert_item(text, index = -1) Creates and inserts a new item in the list. :param text: The text of the item. :type text: str :param index: The index where the new item will be inserted. If the index is -1 then it will be at the end of the list. :type index: int .. py:class:: RadioButton(parent = None, text = "") Base class: :py:class:`Widget` A RadioButton with a text label on the left. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param text: The text on left of the RadioButton. :type text: str .. py:property:: checked Whether the RadioButton is checked or not. :type: bool .. py:property:: text The text of the RadioButton. :type: str .. py:property:: on_toggle The function that is called when the RadioButton is toggled. :type: Callable[[bool], None] .. py:class:: Slider(parent = None, orientation = Orientation.HORIZONTAL, minimum = 0, maximum = 100, tick = Tick.NONE) Base class: :py:class:`Widget` An horizontal or vertical slider. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param orientation: Whether the slider is vertical or horizontal. :type orientation: Orientation :param minimum: The minimum value of the slider. :type minimum: int :param maximum: The maximum value of the slider. :type maximum: int :param tick: The tick position of the slider. :type tick: Tick .. py:property:: maximum The maximum value of the slider. :type: int .. py:property:: minimum The minimum value of the slider. :type: int .. py:property:: value The value of the slider. :type: int .. py:property:: tick_interval The tick interval of the slider. :type: int .. py:property:: tick_position The tick position of the slider. :type: Tick .. py:property:: on_value_changed The function that will be called when the value of the slider changes. :type: Callable[[int], None] .. py:property:: on_slider_pressed The function that will be called when the slider is pressed. :type: Callable[[None], None] .. py:property:: on_slider_moved The function that will be called when the slider is moved. :type: Callable[[int], None] .. py:property:: on_slider_released The function that will be called when the slider is released. :type: Callable[[None], None] .. py:class:: SpinBox(parent = None, value = 0, minimum = 0, maximum = 100, step = 1) Base class: :py:class:`Widget` An integer input. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param value: The default value. :type value: int :param minimum: The minimum value. :type minimum: int :param maximum: The maximum value. :type maximum: int :param step: The step between two values of the SpinBox. :type step: int .. py:property:: maximum The maximum value of the SpinBox. :type: int .. py:property:: minimum The minimum value of the SpinBox. :type: int .. py:property:: step The step between two values of the SpinBox. :type: int .. py:property:: value The value of the SpinBox. :type: int .. py:property:: prefix The text that will be printed before the value. :type: str .. py:property:: suffix The text that will be printed after the value. :type: str .. py:property:: on_value_changed The function that is called when the SpinBox value changes. :type: Callable[[int], None] .. py:property:: on_text_changed The function that is called when the SpinBox value changes, as string. :type: Callable[[str], None] .. py:method:: clean_text() Remove all non numeric text from the SpinBox. .. py:class:: TextEdit(parent = None, text = "") Base class: :py:class:`Widget` A multi-line text input. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param text: The text in the TextEdit. :type text: str .. py:property:: text The text of the TextEdit. :type: str .. py:property:: on_text_changed The function that will be called when the text of the TextEdit changes. :type: Callable[[str], None] .. py:property:: on_selection_changed "The function that will be called when the text selection is changed. :type: Callable[[None], None] .. py:method:: adjust_size() Adjust the size of the TextEdit with the size of the text. .. py:class:: VButtonGroup(parent = None, title = "") Base class: :py:class:`Widget` A widget which is a group of button. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param title: The text on the top of the group. :type title: str .. py:class:: Window(parent = None, name = "") Base class: :py:class:`Widget` An empty widget on which it is possible to add other widgets. :param parent: The parent :py:class:`Widget`. :type parent: Widget :param name: Title of the window. :type name: str .. py:method:: show() Display the window on the screen when :py:meth:`Application.exec()` is called. .. py:method:: close() Closes the window.