TTkTerminalViewπΆοΈ
- class TTkTerminalView(**kwargs)[source]πΆοΈ
Bases:
TTkAbstractScrollView
,_TTkTerminal_CSI_DEC
TTkTerminalView
is a terminal emulator fot TermTkWarning
This is an Alpha feature, it is not optimized and the API definition may change in the future
TermShot from: tests/t.pty/test.pty.006.terminal.07.py
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β Terminello n.1 [_][^][x]β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’ β $ neofetch β²β β`.-::---.. PierCecco@FrankenstOne ββ β .:++++ooooosssoo:. --------------------------- ββ β .+o++::. `.:oos+. OS: LMDE 6 (faye) x86_64 ββ β :oo:.` -+oo: Host: Lemur Pro lemp11 ββ β `+o/` .::::::-. .++-` Kernel: 6.1.0-26-amd64 ββ β`/s/ .yyyyyyyyyyo: +o-` Uptime: 27 days, 2 hours, 33 mins ββ β`so .ss ohyo` :s-: Packages: 2787 (dpkg), 38 (flatpak) ββ β`s/ .ss h m myy/ /s`` Shell: bash 5.2.15 ββ β`s: `oo s m Myy+-o:` Resolution: 1920x1080, 3440x1440 ββ β`oo :+sdoohyoydyso/. DE: Cinnamon 6.2.9 ββ β :o. .:////////++: WM: Mutter (Muffin) ββ β `/++ -:::::- WM Theme: Mint-Y-Dark-Orange (Mint-Y) ββ β `++- Theme: Mint-L-Dark [GTK2/3] ββ β `/+- Icons: Mint-X-Orange [GTK2/3] ββ β .+/. Terminal: tmux ββ β .:+-. CPU: 12th Gen Intel i7-1255U (12) @ 4.700GHz ββ β `--.`` GPU: Intel Alder Lake-UP3 GT2 [Iris Xe Graphics] ββ β Memory: 32111MiB / 39956MiB ββ β ββ β23 PierCecco FrankenstOne < 12:24 > (1052) ~/github/Varie/pyTermTk ββ β $ βΌβ ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Quickstart:
import TermTk as ttk root = ttk.TTk(mouseTrack=True) win = ttk.TTkWindow(parent=root, title="Terminal", size=(80+2,24+4), layout=ttk.TTkGridLayout()) term = ttk.TTkTerminal(parent=win) th = ttk.TTkTerminalHelper(term=term) th.runShell() root.mainloop()
More examples are available here.
TTkContainer
βs inherited init params:- Parameters:
layout (
TermTk.TTkLayouts
) β the layout of this widget, optional, defaults toTTkLayout
padding (
TTkPadding
) β the padding (top, bottom, left, right) of the widget, defaults to (0,0,0,0)paddingTop (int) β the Top padding, override Top padding if already defined, optional, default=0 if padding is not defined
paddingBottom (int) β the Bottom padding, override Bottom padding if already defined, optional, default=0 if padding is not defined
paddingLeft (int) β the Left padding, override Left padding if already defined, optional, default=0 if padding is not defined
paddingRight (int) β the Right padding, override Right padding if already defined, optional, default=0 if padding is not defined
forwardStyle (bool) β [Experimental] any change of style will reflect the children, defaults to False
TTkWidget
βs inherited init params:- Parameters:
name (str, optional) β the name of the widget, defaults to ββ
parent (
TTkWidget
, optional) β the parent widget, defaults to Nonex (int, optional) β the x position, defaults to 0
y (int, optional) β the y position, defaults to 0
pos ((int,int), optional) β the [x,y] position (override the previously defined x, y), defaults to (x,y)
width (int, optional) β the width of the widget, defaults to 0
height (int, optional) β the height of the widget, defaults to 0
size ((int,int), optional) β the size [width, height] of the widget (override the previously defined sizes), defaults to (width,height)
maxWidth (int, optional) β the maxWidth of the widget, defaults to 0x10000
maxHeight (int, optional) β the maxHeight of the widget, defaults to 0x10000
maxSize ((int,int), optional) β the max [width,height] of the widget, optional, defaults to (maxWidth,maxHeight)
minWidth (int, optional) β the minWidth of the widget, defaults to 0
minHeight (int, optional) β the minHeight of the widget, defaults to 0
minSize ((int,int), optional) β the minSize [width,height] of the widget, optional, defaults to (minWidth,minHeight)
toolTip (
TTkString
, optional) β This property holds the widgetβs tooltip, defaults to ββstyle (dict, optional) β this field hold the custom style to be used by this widget
addStyle (dict, optional) β 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
SignalsπΆοΈ
This signal is emitted when the bell is received.
This signal is emitted whenever the widget is closed
This signal is emitted whenever the widget stye change
This signal is emitted whenever the focus status change i.e. with the
setFocus()
orclearFocus()
methods.This signal is emitted whenever the widget size change
This signal is emitted when data event fires.
This signal is emitted when the terminal is resized.
This signal is emitted when the terminl is closed.
This signal is emitted when a text is selected.
This signal is emitted when the terminal title change through OSC "ESC ]0;"
This signal is emitted whenever there is a change in the view content topology (size,pos)
This signal is emitted when the view content move to a new position (x,y),
This signal is emitted when the view content size changed
SlotsπΆοΈ
Slots Inherited from:
TTkAbstractScrollView
viewMoveTo
(x,Β y)This method is used to set the vertical and horizontal offsets of the
TTkAbstractScrollViewInterface
Slots Inherited from:
TTkContainer
hide
()hide the widget
show
()show the widget
Slots Inherited from:
TTkWidget
close
()Close (Destroy/Remove) the widget
hide
()hide the widget
lowerWidget
()Lower the Widget below its relatives
raiseWidget
([raiseParent])Raise the Widget above its relatives
setDisabled
([disabled])This property holds whether the widget is disnabled
setEnabled
([enabled])This property holds whether the widget is enabled
setFocus
()Focus the widget
setVisible
(visible)Set the visibility status of this widget
show
()show the widget
update
([repaint,Β updateLayout,Β updateParent])Notify the drawing routine that the widget changed and needs to draw its new content.
MembersπΆοΈ
- bell: pyTTkSignalπΆοΈ
This signal is emitted when the bell is received.
- closed: pyTTkSignalπΆοΈ
This signal is emitted whenever the widget is closed
- Parameters:
widget (TTkWidget) β the widget closed (=self)
- currentStyleChanged: pyTTkSignalπΆοΈ
This signal is emitted whenever the widget stye change
- Parameters:
style (dict) β the new style applied
- focusChanged: pyTTkSignalπΆοΈ
This signal is emitted whenever the focus status change i.e. with the
setFocus()
orclearFocus()
methods- Parameters:
status (bool) β the curent focus status
- sizeChanged: pyTTkSignalπΆοΈ
This signal is emitted whenever the widget size change
- Parameters:
width (int) β the new widget width
height (int) β the new widget height
- termData: pyTTkSignalπΆοΈ
This signal is emitted when data event fires.
This happens for example when the user types or pastes into the terminal. The event value is whatever βstrβ results, in a typical setup, this should be passed on to the backing pty.
This signal is used in
TTkTerminalHelper
throughTTkTerminalHelper.attachTTkTerminal()
to frward all the terminal events to the pty interface.- Parameters:
data (str) β the event data
- termResized: pyTTkSignalπΆοΈ
This signal is emitted when the terminal is resized.
- Parameters:
size ((int,int)) β the new size [width, height] of the terminal
- terminalClosed: pyTTkSignalπΆοΈ
This signal is emitted when the terminl is closed.
- textSelected: pyTTkSignalπΆοΈ
This signal is emitted when a text is selected.
- Parameters:
text (
ttkString
) β the selected text
- titleChanged: pyTTkSignalπΆοΈ
This signal is emitted when the terminal title change through OSC βESC ]0;β
- Parameters:
title (str) β the new title
- viewChanged: pyTTkSignalπΆοΈ
This signal is emitted whenever there is a change in the view content topology (size,pos)
Note
This signal must be implemented in any implementation of
TTkAbstractScrollView
to notify that the view content boudaries changed
- viewMovedTo: pyTTkSignalπΆοΈ
This signal is emitted when the view content move to a new position (x,y),
- Parameters:
x (int) β the new horizontal offset
y (int) β the new vertical offset
- viewSizeChanged: pyTTkSignalπΆοΈ
This signal is emitted when the view content size changed
- Parameters:
width (int) β the new width
height (int) β the new heighht
MethodsπΆοΈ
- termSize() tuple[int, int] [source]πΆοΈ
This property holds the size of the terminal
- Returns:
a tuple of 2 integers (width, height)
- Return type:
tuple
- termWrite(data: str) None [source]πΆοΈ
Write data to the terminal.
- Params data:
the data to write
- viewFullAreaSize() -> (<class 'int'>, <class 'int'>)[source]πΆοΈ
This method returns the full widget area size of the
TTkAbstractScrollViewInterface
implementation.This is required to TTkAbstractScrollArea implementation to handle the on-demand scroll bars.
Note
Reimplement this function to handle this event
- Returns:
the full area size as a tuple of 2 int elements (width,height)
- Return type:
tuple[int,int]
Methods Inherited from:
TTkAbstractScrollView
getViewOffsets
()Retrieve the vertical and horizontal offsets of the
TTkAbstractScrollViewInterface
resizeEvent
(w,Β h)Convenience function, Event Callback triggered after a successful resize
update
([repaint,Β updateLayout,Β updateParent])Notify the drawing routine that the widget changed and needs to draw its new content.
viewDisplayedSize
()This method returns the displayed size of the
TTkAbstractScrollViewInterface
implementation.viewMoveTo
(x,Β y)This method is used to set the vertical and horizontal offsets of the
TTkAbstractScrollViewInterface
wheelEvent
(evt)This event handler, can be reimplemented in a subclass to receive mouse wheel events for the widget.
Methods Inherited from:
TTkContainer
addWidget
(widget)getPadding
()Retrieve the
TTkContainer
's paddings sizes as shown in Layout TopologygetWidgetByName
(name)Return the widget from its name.
hide
()hide the widget
layout
()Get the Layout
maximumHeight
()maximumWidth
()minimumHeight
()minimumWidth
()mouseEvent
(evt)paintChildCanvas
()removeWidget
(widget)rootLayout
()This is a root layout mainly used to place items that are not supposed to be inside the main layout (i.e. the menu elements).
setCurrentStyle
(*args,Β **kwargs)setLayout
(layout)Set the Layout used by this widget to place all the child widgets.
setPadding
(top,Β bottom,Β left,Β right)Set the
TTkContainer
's paddings sizes as shown in Layout Topologyshow
()show the widget
update
([repaint,Β updateLayout,Β updateParent])Notify the drawing routine that the widget changed and needs to draw its new content.
Methods Inherited from:
TTkWidget
clearFocus
()Remove the Focus state of this widget
close
()Close (Destroy/Remove) the widget
currentStyle
()disableWidgetCursor
([disable])enableWidgetCursor
([enable])focusInEvent
()focusOutEvent
()focusPolicy
()geometry
()getCanvas
()getPixmap
()Convenience function which return a pixmap representing the current widget status
getWidgetByName
(name)Return the widget from its name.
hasFocus
()This property holds the focus status of this widget
height
()hide
()hide the widget
isEnabled
()This property holds whether the widget is enabled
isEntered
()isVisible
()Retrieve the visibility status of this widget
isVisibleAndParent
()lowerWidget
()Lower the Widget below its relatives
maxDimension
(orientation)maximumHeight
()maximumSize
()maximumWidth
()mergeStyle
(style)minDimension
(orientation)minimumHeight
()minimumSize
()minimumWidth
()mouseEvent
(evt)move
(x,Β y)Move the widget
moveEvent
(x,Β y)Convenience function, Event Callback triggered after a successful move
name
()paintChildCanvas
()paintEvent
(canvas)Paint Event callback, this need to be overridden in the widget.
parentWidget
()pasteEvent
(txt)Callback triggered when a paste event is forwarded to this widget.
pos
()raiseWidget
([raiseParent])Raise the Widget above its relatives
resize
(width,Β height)Resize the widget
resizeEvent
(w,Β h)Convenience function, Event Callback triggered after a successful resize
setCurrentStyle
(*args,Β **kwargs)setDefaultSize
(arg,Β width,Β height)setDisabled
([disabled])This property holds whether the widget is disnabled
setEnabled
([enabled])This property holds whether the widget is enabled
setFocus
()Focus the widget
setFocusPolicy
(policy)This property holds the way the widget accepts keyboard focus
setGeometry
(x,Β y,Β width,Β height)Resize and move the widget
setMaximumHeight
(maxh)setMaximumSize
(maxw,Β maxh)setMaximumWidth
(maxw)setMinimumHeight
(minh)setMinimumSize
(minw,Β minh)setMinimumWidth
(minw)setName
(name)Set the name of this Instance
setParent
(parent)setStyle
([style])setToolTip
(toolTip)setVisible
(visible)Set the visibility status of this widget
setWidgetCursor
([pos,Β type])show
()show the widget
size
()style
()toolTip
()update
([repaint,Β updateLayout,Β updateParent])Notify the drawing routine that the widget changed and needs to draw its new content.
widgetItem
()width
()x
()y
()Methods Inherited from:
TMouseEvents
enterEvent
(evt)This event handler, can be reimplemented in a subclass to receive mouse enter events for the widget.
leaveEvent
(evt)This event handler, can be reimplemented in a subclass to receive mouse leave events for the widget.
mouseDoubleClickEvent
(evt)This event handler, can be reimplemented in a subclass to receive mouse click events for the widget.
mouseDragEvent
(evt)This event handler, can be reimplemented in a subclass to receive mouse drag events for the widget.
mouseMoveEvent
(evt)This event handler, can be reimplemented in a subclass to receive mouse move events for the widget.
mousePressEvent
(evt)This event handler, can be reimplemented in a subclass to receive mouse press events for the widget.
mouseReleaseEvent
(evt)This event handler, can be reimplemented in a subclass to receive mouse release events for the widget.
mouseTapEvent
(evt)This event handler, can be reimplemented in a subclass to receive mouse click events for the widget.
wheelEvent
(evt)This event handler, can be reimplemented in a subclass to receive mouse wheel events for the widget.
Methods Inherited from:
TKeyEvents
keyEvent
(evt)This event handler, can be reimplemented in a subclass to receive key events for the widget.
Methods Inherited from:
TDragEvents
dragEnterEvent
(evt)This event handler, can be reimplemented in a subclass to receive drag events for the widget.
dragLeaveEvent
(evt)This event handler, can be reimplemented in a subclass to receive drag events for the widget.
dragMoveEvent
(evt)This event handler, can be reimplemented in a subclass to receive drag events for the widget.
dropEvent
(evt)This event handler, can be reimplemented in a subclass to receive drag events for the widget.
TTkTerminalView AttributesπΆοΈ
|
|
|
|
|
|
|
|
|
|
|
|
|