TTkCanvas🌶️

class TTkCanvas(width: int = 0, height: int = 0)[source]🌶️

Bases: object

Init the Canvas object

Parameters:
  • width (int) – the width of the Canvas

  • height (int) – the height of the Canvas

Methods🌶️

clean()[source]🌶️
cleanBuffers()[source]🌶️
copy()[source]🌶️
copyBuffers()[source]🌶️
drawBox(pos, size, color=<TermTk.TTkCore.color._TTkColor object>, grid=0)[source]🌶️
drawBoxTitle(pos, size, text, align=4, color=<TermTk.TTkCore.color._TTkColor object>, colorText=<TermTk.TTkCore.color._TTkColor object>, grid=0)[source]🌶️
drawButtonBox(pos, size, color=<TermTk.TTkCore.color._TTkColor object>, grid=0)[source]🌶️
drawChar(pos, char, color=<TermTk.TTkCore.color._TTkColor object>)[source]🌶️
drawGrid(pos, size, hlines=[], vlines=[], color=<TermTk.TTkCore.color._TTkColor object>, grid=0)[source]🌶️
drawHChart(pos, values, zoom=1.0, color=<TermTk.TTkCore.color._TTkColor object>)[source]🌶️
drawHLine(pos, size, color=<TermTk.TTkCore.color._TTkColor object>)[source]🌶️
drawMenuBarBg(pos, size, color=<TermTk.TTkCore.color._TTkColor object>)[source]🌶️
drawScroll(pos, size, slider, orientation, color=<TermTk.TTkCore.color._TTkColor object>)[source]🌶️
drawTTkString(pos, text, width=None, color=<TermTk.TTkCore.color._TTkColor object>, alignment=0, forceColor=False)[source]🌶️

NOTE: drawText is one of the most abused functions, there is some redundant code here in order to reduce the footprint

drawTab(pos, size, labels, labelsPos, selected, offset, leftScroller, rightScroller, slim=False, menu=False, color=<TermTk.TTkCore.color._TTkColor object>, borderColor=<TermTk.TTkCore.color._TTkColor object>, selectColor=<TermTk.TTkCore.color._TTkColor object>, offsetColor=<TermTk.TTkCore.color._TTkColor object>, sideBorder=12)[source]🌶️
drawTabButton(pos, size, sideEnd, small, status, color=<TermTk.TTkCore.color._TTkColor object>)[source]🌶️
drawTabMenuButton(pos, size, text, slim=False, color=<TermTk.TTkCore.color._TTkColor object>, borderColor=<TermTk.TTkCore.color._TTkColor object>, sideBorder=12)[source]🌶️
drawTabWidgetBottomLine(pos, size)[source]🌶️
drawTableLine(pos, items, sizes, colors, alignments)[source]🌶️
drawText(text='', pos=(0, 0), width=None, color=<TermTk.TTkCore.color._TTkColor object>, alignment=0, forceColor=False)[source]🌶️

NOTE: drawText is one of the most abused functions, there is some redundant code here in order to reduce the footprint

drawVLine(pos, size, color=<TermTk.TTkCore.color._TTkColor object>)[source]🌶️
enableDoubleBuffer()[source]🌶️
execPaint(winw, winh)[source]🌶️
fill(pos=(0, 0), size=None, char=' ', color=<TermTk.TTkCore.color._TTkColor object>)[source]🌶️
hide()[source]🌶️
paintCanvas(canvas, geom, _slice, bound)[source]🌶️
pushToTerminal(x, y, w, h)[source]🌶️
pushToTerminalBuffered(x, y, w, h)[source]🌶️
pushToTerminalBufferedNew(x, y, w, h)[source]🌶️
resize(w, h)[source]🌶️

resize the canvas keeping or cutting the current one

Parameters:
  • w – the width of the new canvas

  • h – the height of the new canvas

setTransparent(tr=True)[source]🌶️
show()[source]🌶️
size()[source]🌶️
toAnsi()[source]🌶️
transparent() bool[source]🌶️
updateSize()[source]🌶️