TTkTerminalHelperπΆοΈ
- class TTkTerminalHelper(*, term: TTkTerminal = None)[source]πΆοΈ
Bases:
object
TTkTerminalHelper
is a convenience class that simplify the initilization and the handling of a pty terminal sessionNote
This helper is available only on Linux and Mac
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()
- Parameters:
term (
TTkTerminal
) β The terminal handled by this helper.
SignalsπΆοΈ
This signal is emitted when some data is available in the pty interface
This signal is emitted when the pty session ends
SlotsπΆοΈ
push
(data)Send the data to the pty session
resize
(width,Β height)Send a resize "TIOCSWINSZ" ioctl to the pty session
MembersπΆοΈ
- dataOut: pyTTkSignalπΆοΈ
This signal is emitted when some data is available in the pty interface
- Parameters:
data (str) β the pty data
- terminalClosed: pyTTkSignalπΆοΈ
This signal is emitted when the pty session ends
MethodsπΆοΈ
- attachTTkTerminal(term: TTkTerminal) None [source]πΆοΈ
Attach a
TTkTerminal
to this helper.- Parameters:
term (
TTkTerminal
) β The terminal handled by this helper.
- loop() None [source]πΆοΈ
This is the main loop routine responsible of handling the pty and terminal events, for example, forwarding the input codes to the pty session and the pty output to the terminal emulator.
TTkTerminal βββββββββ pty β C:\ β --[ KeyPresses, MouseEvents, ResizeSignal, ... ]--> βββββ ββ β β β β <---------[ Output, Ansi escape codes, ... ]------- β bash, sh, ... βββββββββ βββββ ββ β β
Caution
Do not touch this! (unless you know what you are doing)
- push(data: str) None [source]πΆοΈ
Send the data to the pty session
- Parameters:
data (str) β the data
- resize(width: int, height: int) None [source]πΆοΈ
Send a resize βTIOCSWINSZβ ioctl to the pty session
- Parameters:
width (int) β the new width
height (int) β the new height