# control.gui_dict:guiObject


Enum object for GUI elements identification.


Usage

``` python
control.gui_dict:guiObject
```


This enum makes it easier to write readable code and identify GUI elements by their name instead of only by a number.


## Attributes

| Name | Description |
|----|----|
| [button](#button) |  |
| [checkbox](#checkbox) |  |
| [combobox](#combobox) |  |
| [doublespinbox](#doublespinbox) |  |
| [hline](#hline) |  |
| [labeltext](#labeltext) |  |
| [lineedit](#lineedit) |  |
| [progressbar](#progressbar) |  |
| [spinbox](#spinbox) |  |
| [togglebutton](#togglebutton) |  |

------------------------------------------------------------------------


### button


`button=``0`


------------------------------------------------------------------------


### checkbox


`checkbox=``2`


------------------------------------------------------------------------


### combobox


`combobox=``4`


------------------------------------------------------------------------


### doublespinbox


`doublespinbox=``7`


------------------------------------------------------------------------


### hline


`hline=``9`


------------------------------------------------------------------------


### labeltext


`labeltext=``8`


------------------------------------------------------------------------


### lineedit


`lineedit=``1`


------------------------------------------------------------------------


### progressbar


`progressbar=``3`


------------------------------------------------------------------------


### spinbox


`spinbox=``6`


------------------------------------------------------------------------


### togglebutton


`togglebutton=``5`


## Methods

| Name | Description |
|----|----|
| [getWidget()](#getWidget) | Return the widget of the correct type. |

------------------------------------------------------------------------


### getWidget()


Return the widget of the correct type.


Usage

``` python
getWidget(
    label,
    wType,
    init=None,
    *,
    modify=None,
)
```


#### Parameters


`label: str`  
Label of the widget; used as fallback button text if no init value is given.

`wType: int or guiObject or str`  
Widget type. Either a guiObject (e.g. guiObject.button) or one of: 0 QPushButton, 1 QLineEdit, 2 QCheckBox, 3 QProgressBar, 4 QComboBox, 5 QPushButton (checkable=True), 6 QSpinBox, 7 QDoubleSpinBox, 8 QLabel (value indicator), 9 QFrame (horizontal separator line), or a str for a QLabel with that text.

`init: (tuple, object) = None`  
Initialization values (button label, valid ranges, combobox entries).


#### Returns


`QWidget or None`  
Widget of requested type or None.


#### Examples

Generate a toggle button which changes its label upon being set:

``` python
>>> getWidget("Property", guiObject.togglebutton,
...           init=("Slow", "Fast"))
```

Generate a QComboBox with prefilled options:

``` python
>>> getWidget("Property", guiObject.combobox,
...           init=("opt 1", "opt 2"))
```

Generate a SpinBox (similar for DoubleSpinBox):

``` python
>>> getWidget("Property", guiObject.spinbox, init=(0, 200))
```

Generate a PushBotton with text "Set":

``` python
>>> getWidget("Property", guiObject.button, init="Set")
```

Generate a label with text "Example":

``` python
>>> getWidget("Property", "Example")
```
