TermTk.TTkWidgets.combobox

TTkComboBox

class TTkComboBox(*args, **kwargs)[source]

TTkComboBox:

Editable = False

[ - select -  ^]

Editable = True

[ Text       [^]
Parameters
  • list (list(str), optional) – the list of the items selectable by this combobox, defaults to “[]”

  • insertPolicy (InsertPolicy, optional) – the policy used to determine where user-inserted items should appear in the combobox, defaults to InsertAtBottom

  • textAlign – This enum type is used to define the text alignment, defaults to CENTER_ALIGN

  • editable (bool, optional) – This property holds whether the combo box can be edited by the user, defaults to False

Tye textAlign

Alignment, optional

addItem(text, userData=None)[source]

Adds an item to the combobox with the given text, and containing the specified userData (stored in the Qt::UserRole). The item is appended to the list of existing items.

addItems(items)[source]
addWidget(widget)

Warning

Method Deprecated,

use TTkWidget -> layout -> addWidget

i.e.

parentWidget.layout().addWidget(childWidget)
clear()[source]
close()
currentIndex()[source]
currentText()[source]
dragEnterEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive drag events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkDropEvent) – The drop event

Returns

True if the event has been handled

Return type

bool

dragLeaveEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive drag events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkDropEvent) – The drop event

Returns

True if the event has been handled

Return type

bool

dragMoveEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive drag events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkDropEvent) – The drop event

Returns

True if the event has been handled

Return type

bool

dropEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive drag events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkDropEvent) – The drop event

Returns

True if the event has been handled

Return type

bool

enterEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive mouse enter events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkMouseEvent) – The mouse event

Returns

True if the event has been handled

Return type

bool

getPadding() -> (<class 'int'>, <class 'int'>, <class 'int'>, <class 'int'>)

Retrieve the widget padding sizes

Returns

list[top, bottom, left, right]: the 4 padding sizes

hide()
insertPolicy()[source]
isEditable()[source]
keyEvent(evt)[source]

This event handler, can be reimplemented in a subclass to receive key events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkKeyEvent) – The keyboard event

Returns

True if the event has been handled

Return type

bool

keyPressEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive key press events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkKeyEvent) – The keyboard event

Returns

True if the event has been handled

Return type

bool

keyReleaseEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive key release events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkKeyEvent) – The keyboard event

Returns

True if the event has been handled

Return type

bool

layout()

Get the layout

Returns

The layout used

Return type

TTkLayout or derived

leaveEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive mouse leave events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkMouseEvent) – The mouse event

Returns

True if the event has been handled

Return type

bool

lowerWidget()
mouseDoubleClickEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive mouse click events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkMouseEvent) – The mouse event

Returns

True if the event has been handled

Return type

bool

mouseDragEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive mouse drag events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkMouseEvent) – The mouse event

Returns

True if the event has been handled

Return type

bool

mouseEvent(evt)

Caution

Don’t touch this!

mouseMoveEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive mouse move events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkMouseEvent) – The mouse event

Returns

True if the event has been handled

Return type

bool

mousePressEvent(evt)[source]

This event handler, can be reimplemented in a subclass to receive mouse press events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkMouseEvent) – The mouse event

Returns

True if the event has been handled

Return type

bool

mouseReleaseEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive mouse release events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkMouseEvent) – The mouse event

Returns

True if the event has been handled

Return type

bool

mouseTapEvent(evt) bool

This event handler, can be reimplemented in a subclass to receive mouse click events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkMouseEvent) – The mouse event

Returns

True if the event has been handled

Return type

bool

move(x: int, y: int)

Move the widget

Parameters
  • x (int) – x position

  • y (int) – y position

moveEvent(x: int, y: int)

Event Callback triggered after a successful move

name() str
paintChildCanvas()

Caution

Don’t touch this!

paintEvent(canvas)[source]

Paint Event callback, this need to be overridden in the widget.

raiseWidget(raiseParent=True)
removeWidget(widget)

Warning

Method Deprecated,

use TTkWidget -> layout -> removeWidget

i.e.

parentWidget.layout().removeWidget(childWidget)
resize(w: int, h: int)

Resize the widget

Parameters
  • w (int) – the new width

  • h (int) – the new height

resizeEvent(w: int, h: int)[source]

Event Callback triggered after a successful resize

setCurrentIndex(index)[source]
setCurrentText(text)[source]
setDisabled(disabled=True)
setEditText(text)[source]
setEditable(editable)[source]
setEnabled(enabled: bool = True)
setFocus()
setGeometry(x: int, y: int, w: int, h: int)

Resize and move the widget

Parameters
  • x (int) – x position

  • y (int) – y position

  • w (int) – the new width

  • h (int) – the new height

setInsertPolicy(ip)[source]
setName(name: str)
setPadding(top: int, bottom: int, left: int, right: int)

Set the padding of the widget

Parameters
  • top (int) – top padding

  • bottom (int) – bottom padding

  • left (int) – left padding

  • right (int) – right padding

setTextAlign(align)[source]

This property holds the displayed text alignment

Parameters

align (Alignment) –

setVisible(visible: bool)
show()
textAlign()[source]

his property holds the displayed text alignment

Returns

Alignment

wheelEvent(evt)[source]

This event handler, can be reimplemented in a subclass to receive mouse wheel events for the widget.

Note

Reimplement this function to handle this event

Parameters

evt (TTkMouseEvent) – The mouse event

Returns

True if the event has been handled

Return type

bool