TTkListWidget๐ŸŒถ๏ธ

class TTkListWidget(*, items: list[str] = [], selectionMode: int = 1, dragDropMode: DragDropMode = 0, showSearch: bool = True, **kwargs)[source]๐ŸŒถ๏ธ

Bases: TTkAbstractScrollView

A TTkListWidget implements a list view that displays a set of selectable items.

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘S-0) --Zero-3- officia         โ–ฒโ•‘
โ•‘S-1) ad ipsum                  โ–“โ•‘
โ•‘S-2) irure nisi                โ”Šโ•‘
โ•‘S-3) minim --Zero-3-           โ”Šโ•‘
โ•‘S-4) ea sunt                   โ”Šโ•‘
โ•‘S-5) qui mollit                โ”Šโ•‘
โ•‘S-6) magna sunt                โ”Šโ•‘
โ•‘S-7) sunt officia              โ–ผโ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Quickstart:

import TermTk as ttk

root = ttk.TTk(layout=ttk.TTkHBoxLayout(), mouseTrack=True)

ttk.TTkList(parent=root, items=["Item 1","Item 2","Item 3"])
ttk.TTkList(parent=root, items=[f"Item 0x{i:03X}" for i in range(100)])

ttkList = ttk.TTkList(parent=root)
ttkList.addItems([f"Item 0x{i:04X}" for i in range(200)])

root.mainloop()
Parameters:
  • items (list[str], optional) โ€“ Use this field to intialize the TTkListWidget with the entries in the items list, defaults to โ€œ[]โ€

  • selectionMode (TTkK.SelectionMode, optional) โ€“ This property controls whether the user can select one or many items, defaults to TTkK.SelectionMode.SingleSelection.

  • dragDropMode (TTkK.DragDropMode, optional) โ€“ This property holds the drag and drop event the view will act upon, defaults to TTkK.DragDropMode.NoDragDrop.

  • showSearch (bool, optional) โ€“ Show the search hint at the top of the list, defaults to True.

TTkContainerโ€™s inherited init params:

Parameters:
  • layout (TermTk.TTkLayouts) โ€“ the layout of this widget, optional, defaults to TTkLayout

  • 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 None

  • x (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

TMouseEventsโ€™s inherited init params:

Initialize self. See help(type(self)) for accurate signature.

TDragEventsโ€™s inherited init params:

Initialize self. See help(type(self)) for accurate signature.

Style๐ŸŒถ๏ธ

classStyle = {
    'default':{'searchColor': TTkColor.fg("#FFFF00") + TTkColor.UNDERLINE}}

@dataclass(frozen=True)
class _DropListData:
    widget: TTkAbstractScrollView
    items: list

__slots__ = ('_selectedItems', '_selectionMode',
             '_highlighted', '_items', '_filteredItems',
             '_dragPos', '_dndMode',
             '_searchText', '_showSearch',
             # Signals
             'itemClicked', 'textClicked', 'searchModified')
def __init__(self, *,
             items:list[str]=[],
             selectionMode:int=TTkK.SelectionMode.SingleSelection,
             dragDropMode:TTkK.DragDropMode=TTkK.DragDropMode.NoDragDrop,
             showSearch:bool=True,
             **kwargs) -> None:
    '''
    :param items: Use this field to intialize the :py:class:`TTkListWidget` with the entries in the items list, defaults to "[]"
    :type items: list[str], optional
    :param selectionMode: This property controls whether the user can select one or many items, defaults to :py:class:`TTkK.SelectionMode.SingleSelection`.
    :type selectionMode: :py:class:`TTkK.SelectionMode`, optional
    :param dragDropMode: This property holds the drag and drop event the view will act upon, defaults to :py:class:`TTkK.DragDropMode.NoDragDrop`.
    :type dragDropMode: :py:class:`TTkK.DragDropMode`, optional
    :param showSearch: Show the search hint at the top of the list, defaults to True.
    :type showSearch: bool, optional
    '''
    # Signals
    self.itemClicked = pyTTkSignal(TTkAbstractListItem)
    self.textClicked = pyTTkSignal(str)
    self.searchModified = pyTTkSignal(str)

    # Default Class Specific Values
    self._selectionMode = selectionMode
    self._selectedItems:list[TTkAbstractListItem] = []
    self._items:list[TTkAbstractListItem]= []
    self._filteredItems:list[TTkAbstractListItem] = self._items
    self._highlighted = None
    self._dragPos = None
    self._dndMode = dragDropMode
    self._searchText:str = ''
    self._searchVisibility:bool = showSearch
    # Init Super
    super().__init__(**kwargs)
    self.addItems(items)
    self.viewChanged.connect(self._viewChangedHandler)
    self.setFocusPolicy(TTkK.ClickFocus + TTkK.TabFocus)
    self.searchModified.connect(self._searchModifiedHandler)

@pyTTkSlot()
def _viewChangedHandler(self):
    x,y = self.getViewOffsets()
    self.layout().setOffset(-x,-y)

@pyTTkSlot(TTkAbstractListItem)
def _labelSelectedHandler(self, label:TTkAbstractListItem):
    if self._selectionMode == TTkK.SingleSelection:
        for item in self._selectedItems:
            item._setSelected(False)
            item._setHighlighted(False)
        self._selectedItems = [label]
        label._setSelected(True)
    elif self._selectionMode == TTkK.MultiSelection:
        for item in self._selectedItems:
            item._setHighlighted(False)
        label._setSelected(not label._selected)
        if label._selected:
            self._selectedItems.append(label)
        else:
            self._selectedItems.remove(label)
    if self._highlighted:
        self._highlighted._setHighlighted(False)
    label._setHighlighted(True)
    self._highlighted = label
    self.itemClicked.emit(label)
    self.textClicked.emit(label.text())

@pyTTkSlot(str)
def _searchModifiedHandler(self, text:str='s') -> None:
    if self._searchVisibility and self._searchText:
        self.setPadding(1,0,0,0)
    else:
        self.setPadding(0,0,0,0)

    if self._searchText:
        text = self._searchText.lower()
        self._filteredItems = [i for i in self._items if text in i._lowerText]
        for item in self._items:
            item._quickVisible = text in item._lowerText
    else:
        self._filteredItems = self._items
        for item in self._items:
            item.setVisible(True)

    self._placeItems()

def search(self) -> str:
    '''search'''
    return self._searchText

def setSearch(self, search:str) -> None:
    '''setSearch'''
    self._searchText = search
    self.searchModified.emit(search)

def searchVisibility(self) -> bool:
    '''searchVisibility'''
    return self._searchVisibility

def setSearchVisibility(self, visibility:bool) -> None:
    '''setSearchVisibility'''
    self._searchVisibility = visibility

def dragDropMode(self):
    '''dragDropMode'''
    return self._dndMode

def setDragDropMode(self, dndMode):
    '''setDragDropMode'''
    self._dndMode = dndMode

def selectionMode(self):
    '''selectionMode'''
    return self._selectionMode

def setSelectionMode(self, mode):
    '''setSelectionMode'''
    self._selectionMode = mode

def selectedItems(self):
    '''selectedItems'''
    return self._selectedItems

def selectedLabels(self):
    '''selectedLabels'''
    return [i.text() for i in self._selectedItems]

def items(self) -> list[TTkAbstractListItem]:
    '''items'''
    return self._items

def filteredItems(self) -> list[TTkAbstractListItem]:
    '''filteredItems'''
    return self._filteredItems

def resizeEvent(self, w, h):
    maxw = 0
    for item in self.layout().children():
        maxw = max(maxw,item.minimumWidth())
    maxw = max(self.width(),maxw)
    for item in self.layout().children():
        x,y,_,h = item.geometry()
        item.setGeometry(x,y,maxw,h)
    TTkAbstractScrollView.resizeEvent(self, w, h)

def addItem(self, item, data=None):
    '''addItem'''
    self.addItemAt(item, len(self._items), data)

def addItems(self, items):
    '''addItems'''
    self.addItemsAt(items=items, pos=len(self._items))

def _placeItems(self):
    minw = self.width()
    for item in self._items:
        if item in self._filteredItems:
            minw = max(minw,item.minimumWidth())
    for y,item in enumerate(self._filteredItems):
        item.setGeometry(0,y,minw,1)
    self.viewChanged.emit()
    self.update()

def addItemAt(self, item, pos, data=None):
    '''addItemAt'''
    if isinstance(item, str) or isinstance(item, TTkString):
        item = TTkAbstractListItem(text=item, data=data)
    return self.addItemsAt([item],pos)

def addItemsAt(self, items, pos):
    '''addItemsAt'''
    items = [TTkAbstractListItem(text=i) if isinstance(i, str) or isinstance(i, TTkString) else i for i in items]
    for item in items:
        if not issubclass(type(item),TTkAbstractListItem):
            TTkLog.error(f"{item=} is not an TTkAbstractListItem")
            return
    for item in items:
        item.listItemClicked.connect(self._labelSelectedHandler)
    self._items[pos:pos] = items
    self.layout().addWidgets(items)
    self._placeItems()

def indexOf(self, item):
    '''indexOf'''
    for i, it in enumerate(self._items):
        if it == item:
            return i
    return -1

def itemAt(self, pos):
    '''itemAt'''
    return self._items[pos]

def moveItem(self, fr, to):
    '''moveItem'''
    fr = max(min(fr,len(self._items)-1),0)
    to = max(min(to,len(self._items)-1),0)
    # Swap
    self._items[to] , self._items[fr] = self._items[fr] , self._items[to]
    self._placeItems()

def removeItem(self, item):
    '''removeItem'''
    self.removeItems([item])

def removeItems(self, items):
    '''removeItems'''
    self.layout().removeWidgets(items)
    for item in items.copy():
        item.listItemClicked.disconnect(self._labelSelectedHandler)
        item._setSelected(False)
        item._setHighlighted(False)
        self._items.remove(item)
        if item in self._selectedItems:
            self._selectedItems.remove(item)
        if item == self._highlighted:
            self._highlighted = None
    self._placeItems()

def removeAt(self, pos):
    '''removeAt'''
    self.removeItem(self._items[pos])

def setCurrentRow(self, row):
    '''setCurrentRow'''
    if row<len(self._items):
        item = self._items[row]
        self.setCurrentItem(item)

def setCurrentItem(self, item):
    '''setCurrentItem'''
    item.listItemClicked.emit(item)

def _moveToHighlighted(self):
    index = self._items.index(self._highlighted)
    h = self.height()
    offx,offy = self.getViewOffsets()
    if index >= h+offy-1:
        TTkLog.debug(f"{index} {h} {offy}")
        self.viewMoveTo(offx, index-h+1)
    elif index <= offy:
        self.viewMoveTo(offx, index)

def mousePressEvent(self, evt:TTkMouseEvent) -> bool:
    return True

def mouseDragEvent(self, evt:TTkMouseEvent) -> bool:
    if not(self._dndMode & TTkK.DragDropMode.AllowDrag):
        return False
    if not (items:=self._selectedItems.copy()):
        return True
    drag = TTkDrag()
    data =TTkListWidget._DropListData(widget=self,items=items)
    h = min(3,ih:=len(items)) + 2 + (1 if ih>3 else 0)
    w = min(20,iw:=max([it.text().termWidth() for it in items[:3]])) + 2
    pm = TTkCanvas(width=w,height=h)
    for y,it in enumerate(items[:3],1):
        txt = it.text()
        if txt.termWidth() < 20:
            pm.drawText(pos=(1,y), text=it.text())
        else:
            pm.drawText(pos=(1,y), text=it.text(), width=17)
            pm.drawText(pos=(18,y), text='...')
    if ih>3:
        pm.drawText(pos=(1,4), text='...')
    pm.drawBox(pos=(0,0),size=(w,h))
    drag.setPixmap(pm)
    drag.setData(data)
    drag.exec()
    return True

def dragEnterEvent(self, evt:TTkDnDEvent) -> bool:
    if not(self._dndMode & TTkK.DragDropMode.AllowDrop):
        return False
    if issubclass(type(evt.data()),TTkListWidget._DropListData):
        return self.dragMoveEvent(evt)
    return False

def dragMoveEvent(self, evt:TTkDnDEvent) -> bool:
    offx,offy = self.getViewOffsets()
    y=min(evt.y+offy,len(self._items))
    self._dragPos = (offx+evt.x, y)
    self.update()
    return True

def dragLeaveEvent(self, evt:TTkDnDEvent) -> bool:
    self._dragPos = None
    self.update()
    return True

def dropEvent(self, evt:TTkDnDEvent) -> bool:
    if not(self._dndMode & TTkK.DragDropMode.AllowDrop):
        return False
    self._dragPos = None
    if not issubclass(type(evt.data())  ,TTkListWidget._DropListData):
        return False
    t,b,l,r = self.getPadding()
    offx,offy = self.getViewOffsets()
    wid   = evt.data().widget
    items = evt.data().items
    if wid and items:
        wid.removeItems(items)
        wid._searchModifiedHandler()
        for it in items:
            it.setCurrentStyle(it.style()['default'])
        yPos = offy+evt.y-t
        if self._filteredItems:
            if yPos < 0:
                yPos = 0
            elif yPos > len(self._filteredItems):
                yPos = len(self._items)
            elif yPos == len(self._filteredItems):
                filteredItemAt = self._filteredItems[-1]
                yPos = self._items.index(filteredItemAt)+1
            else:
                filteredItemAt = self._filteredItems[yPos]
                yPos = self._items.index(filteredItemAt)
        else:
            yPos = 0
        self.addItemsAt(items,yPos)
        self._searchModifiedHandler()
        return True
    return False

def keyEvent(self, evt:TTkKeyEvent) -> bool:
    # if not self._highlighted: return False
    if ( not self._searchText and evt.type == TTkK.Character and evt.key==" " ) or \
       ( evt.type == TTkK.SpecialKey and evt.key == TTkK.Key_Enter ):
        if self._highlighted:
            # TTkLog.debug(self._highlighted)
            self._highlighted.listItemClicked.emit(self._highlighted)

    elif evt.type == TTkK.Character:
        # Add this char to the search text
        self._searchText += evt.key
        self.update()
        self.searchModified.emit(self._searchText)

    elif ( evt.type == TTkK.SpecialKey and
           evt.key == TTkK.Key_Tab ):
        return False

    elif ( evt.type == TTkK.SpecialKey and
           evt.key in (TTkK.Key_Delete,TTkK.Key_Backspace) and
           self._searchText ):
        # Handle the backspace to remove the last char from the search text
        self._searchText = self._searchText[:-1]
        self.update()
        self.searchModified.emit(self._searchText)

    elif ( evt.type == TTkK.SpecialKey and
           self._filteredItems):
        # Handle the arrow/movement keys
        index = 0
        if self._highlighted:
            self._highlighted._setHighlighted(False)
            if self._highlighted not in self._filteredItems:
                self._highlighted = self._filteredItems[0]
            index = self._filteredItems.index(self._highlighted)
        offx,offy = self.getViewOffsets()
        h = self.height()
        if evt.key == TTkK.Key_Up:
            index = max(0, index-1)
        elif evt.key == TTkK.Key_Down:
            index = min(len(self._filteredItems)-1, index+1)
        elif evt.key == TTkK.Key_PageUp:
            index = max(0, index-h)
        elif evt.key == TTkK.Key_PageDown:
            index = min(len(self._filteredItems)-1, index+h)
        elif evt.key == TTkK.Key_Right:
            self.viewMoveTo(offx+1, offy)
        elif evt.key == TTkK.Key_Left:
            self.viewMoveTo(offx-1, offy)
        elif evt.key == TTkK.Key_Home:
            self.viewMoveTo(0, offy)
        elif evt.key == TTkK.Key_End:
            self.viewMoveTo(0x10000, offy)
        elif evt.key in (TTkK.Key_Delete,TTkK.Key_Backspace):
            if self._searchText:
                self._searchText = self._searchText[:-1]
                self.update()
                self.searchModified.emit(self._searchText)
        self._highlighted = self._filteredItems[index]
        self._highlighted._setHighlighted(True)
        self._moveToHighlighted()

    else:
        return False
    return True

def focusInEvent(self):
    if not self._items: return
    if not self._highlighted:
        self._highlighted = self._items[0]
    self._highlighted._setHighlighted(True)
    self._moveToHighlighted()

def focusOutEvent(self):
    if self._highlighted:
        self._highlighted._setHighlighted(False)
    self._dragPos = None

# Stupid hack to paint on top of the child widgets
def paintChildCanvas(self):
    super().paintChildCanvas()
    if self._dragPos:
        canvas = self.getCanvas()
        x,y = self._dragPos
        offx,offy = self.getViewOffsets()
        p1 = (0,y-offy-1)
        p2 = (0,y-offy)
        canvas.drawText(pos=p1,text="โ•™โ”€โ•ผ", color=TTkColor.fg("#FFFF00")+TTkColor.bg("#008855"))
        canvas.drawText(pos=p2,text="โ•“โ”€โ•ผ", color=TTkColor.fg("#FFFF00")+TTkColor.bg("#008855"))

def paintEvent(self, canvas):
    if self._searchVisibility and self._searchText:
        w,h = self.size()
        color = self.currentStyle()['searchColor']
        if len(self._searchText) > w:
            text = TTkString("โ‰ผ",TTkColor.BG_BLUE+TTkColor.FG_CYAN)+TTkString(self._searchText[-w+1:],color)
        else:
            text = TTkString(self._searchText,color)
        canvas.drawTTkString(pos=(0,0),text=text, color=color, width=w)

Signals๐ŸŒถ๏ธ

closed

This signal is emitted whenever the widget is closed

currentStyleChanged

This signal is emitted whenever the widget stye change

focusChanged

This signal is emitted whenever the focus status change i.e. with the setFocus() or clearFocus() methods.

itemClicked

This signal is emitted whenever an item is clicked.

searchModified

This signal is emitted whenever the search text is modified.

sizeChanged

This signal is emitted whenever the widget size change

textClicked

This signal is emitted whenever an item is clicked.

viewChanged

This signal is emitted whenever there is a change in the view content topology (size,pos)

viewMovedTo

This signal is emitted when the view content move to a new position (x,y),

viewSizeChanged

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๐ŸŒถ๏ธ

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() or clearFocus() methods

Parameters:

status (bool) โ€“ the curent focus status

itemClicked: pyTTkSignal๐ŸŒถ๏ธ

This signal is emitted whenever an item is clicked.

Parameters:

item (TTkAbstractListItem) โ€“ the item selected

searchModified: pyTTkSignal๐ŸŒถ๏ธ

This signal is emitted whenever the search text is modified.

Parameters:

text (str) โ€“ the search text

sizeChanged: pyTTkSignal๐ŸŒถ๏ธ

This signal is emitted whenever the widget size change

Parameters:
  • width (int) โ€“ the new widget width

  • height (int) โ€“ the new widget height

textClicked: pyTTkSignal๐ŸŒถ๏ธ

This signal is emitted whenever an item is clicked.

Parameters:

text (str) โ€“ the text of the item selected

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๐ŸŒถ๏ธ

addItem(item, data=None)[source]๐ŸŒถ๏ธ
addItemAt(item, pos, data=None)[source]๐ŸŒถ๏ธ
addItems(items)[source]๐ŸŒถ๏ธ
addItemsAt(items, pos)[source]๐ŸŒถ๏ธ
dragDropMode()[source]๐ŸŒถ๏ธ
filteredItems() โ†’ list[TTkAbstractListItem][source]๐ŸŒถ๏ธ
indexOf(item)[source]๐ŸŒถ๏ธ
itemAt(pos)[source]๐ŸŒถ๏ธ
items() โ†’ list[TTkAbstractListItem][source]๐ŸŒถ๏ธ
moveItem(fr, to)[source]๐ŸŒถ๏ธ
removeAt(pos)[source]๐ŸŒถ๏ธ
removeItem(item)[source]๐ŸŒถ๏ธ
removeItems(items)[source]๐ŸŒถ๏ธ
search() โ†’ str[source]๐ŸŒถ๏ธ
searchVisibility() โ†’ bool[source]๐ŸŒถ๏ธ
selectedItems()[source]๐ŸŒถ๏ธ
selectedLabels()[source]๐ŸŒถ๏ธ
selectionMode()[source]๐ŸŒถ๏ธ
setCurrentItem(item)[source]๐ŸŒถ๏ธ
setCurrentRow(row)[source]๐ŸŒถ๏ธ
setDragDropMode(dndMode)[source]๐ŸŒถ๏ธ
setSearch(search: str) โ†’ None[source]๐ŸŒถ๏ธ
setSearchVisibility(visibility: bool) โ†’ None[source]๐ŸŒถ๏ธ
setSelectionMode(mode)[source]๐ŸŒถ๏ธ

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

setPadding(top, bottom, left, right)

Set the TTkContainer's paddings sizes as shown in Layout Topology

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.

viewFullAreaSize()

This method returns the full widget area 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 Topology

getWidgetByName(name)

Return the widget from its name.

hide()

hide the widget

layout()

Get the Layout

maximumHeight()

maximumWidth()

minimumHeight()

minimumWidth()

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 Topology

show()

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.

TTkListWidget Attributes๐ŸŒถ๏ธ

classStyle