TermTk.TTkWidgets.widget
TTkWidget
- class TTkWidget(**kwargs)[source]
Widget sizes:
Terminal area (i.e. XTerm) = TTk ┌─────────────────────────────────────────┐ │ │ │ TTkWidget width │ │ (x,y)┌─────────────────────────┐ │ │ │ │ │ │ │ │ height │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────┘ │ └─────────────────────────────────────────┘
The TTkWidget class is the base class of all user interface objects
- Parameters
name (str, optional) – the name of the widget, defaults to “”
parent (
TTkWidget
, optional) – the parent widget, defaults to Nonex (int) – the x position, defaults to 0
y (int) – the y position, defaults to 0
pos ([int,int]) – the [x,y] position (override the previously defined x, y), optional, default=[0,0]
width (int) – the width of the widget, defaults to 0
height (int) – the height of the widget, defaults to 0
size ([int,int]) – the size [width, height] of the widget (override the previously defined sizes), optional, default=[0,0]
maxWidth (int) – the maxWidth of the widget, optional, defaults to 0x10000
maxHeight (int) – the maxHeight of the widget, optional, defaults to 0x10000
maxSize ([int,int]) – the max [width,height] of the widget, optional
minWidth (int) – the minWidth of the widget, defaults to 0
minHeight (int) – the minHeight of the widget, defaults to 0
minSize ([int,int]) – the minSize [width,height] of the widget, optional
toolTip (
TTkString
) – This property holds the widget’s tooltipstyle (dict) – this field hold the custom style to be used by this widget
addStyle (dict) – this field is required to override/merge the new style on top of the current one, useful if only few params need to be changed
visible (bool,optional) – the visibility, optional, defaults to True
enabled (bool,optional) – the ability to handle input events, optional, defaults to True
- 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
- keyEvent(evt) bool
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
- 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
- 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
- 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) bool
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
- paintEvent(canvas: TTkCanvas)[source]
Paint Event callback, this need to be overridden in the widget.
- resize(w: int, h: int)[source]
Resize the widget
- Parameters
w (int) – the new width
h (int) – the new height
- setGeometry(x: int, y: int, w: int, h: int)[source]
Resize and move the widget
- Parameters
x (int) – x position
y (int) – y position
w (int) – the new width
h (int) – the new height
- wheelEvent(evt) bool
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