TTkFileButtonPicker🌢️

class TTkFileButtonPicker(*, path: str = '.', filter: str = 'All Files (*)', caption: str = 'File Dialog', fileMode: FileMode = 0, acceptMode: AcceptMode = 0, **kwargs)[source]🌢️

Bases: TTkButton

TTkFileButtonPicker:

β”Œβ”€β”€β”€β”€β”
β”‚Fileβ”‚
β•˜β•β•β•β•β•›

╔═════════════════════════════════════════════════════════════════════════╗
β•‘ Pick Something                                                    [^][x]β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘Look in:      [/home/one/github/Varie/pyTermTk                ^][<][>][^]β•‘
β•‘β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•₯────────────────────────────────────────────────────────────┐║
β•‘β”‚βˆ™ Computerβ•‘Name               β–Όβ•ΏSize     β•ΏType   β•ΏDate Modified      β•Ώβ–²β”‚β•‘
β•‘β”‚βˆ™ Home    β•‘   - TTkUiTools/    β”‚         β”‚Folder β”‚2023-04-18 16:38:03β”‚β”Šβ”‚β•‘
β•‘β”‚          β•‘     βˆ™ __init__.py  β”‚ 75 bytesβ”‚File   β”‚2023-04-18 16:38:03β”‚β”Šβ”‚β•‘
β•‘β”‚          β•‘     + __pycache__/ β”‚         β”‚Folder β”‚2023-04-18 23:54:33β”‚β”Šβ”‚β•‘
β•‘β”‚          β•‘     + properties/  β”‚         β”‚Folder β”‚2023-04-18 16:38:03β”‚β”Šβ”‚β•‘
β•‘β”‚          β•‘     βˆ™ uiloader.py  β”‚  7.96 KBβ”‚File   β”‚2023-04-18 16:38:03β”‚β”Šβ”‚β•‘
β•‘β”‚          β•‘     βˆ™ uiproperties.β”‚  2.39 KBβ”‚File   β”‚2023-04-18 16:38:03β”‚β–“β”‚β•‘
β•‘β”‚          β•‘   + TTkWidgets/    β”‚         β”‚Folder β”‚2023-04-18 16:38:03β”‚β–“β”‚β•‘
β•‘β”‚          β•‘   βˆ™ __init__.py    β”‚272 bytesβ”‚File   β”‚2023-04-18 16:38:03β”‚β–“β”‚β•‘
β•‘β”‚          β•‘   + __pycache__/   β”‚         β”‚Folder β”‚2023-04-18 23:54:33β”‚β–“β”‚β•‘
β•‘β”‚          β•‘ + demo/            β”‚         β”‚Folder β”‚2023-04-18 16:38:03β”‚β”Šβ”‚β•‘
β•‘β”‚          β•‘ + docs/            β”‚         β”‚Folder β”‚2023-04-27 22:16:30β”‚β”Šβ”‚β•‘
β•‘β”‚          β•‘ + experiments/     β”‚         β”‚Folder β”‚2023-04-27 13:10:29β”‚β”Šβ”‚β•‘
β•‘β”‚          β•‘ βˆ™ pippo.py         β”‚  1.72 KBβ”‚File   β”‚2023-04-26 21:01:53β”‚β”Šβ”‚β•‘
β•‘β”‚          β•‘ βˆ™ profiler.bin     β”‚256.71 KBβ”‚File   β”‚2023-04-10 06:01:03β”‚β–Όβ”‚β•‘
β•‘β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•¨β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β•‘
β•‘File name:    /home/one/github/Varie/pyTermTk/TermTk/TTkUiTools/ [ Open ]β•‘
β•‘Files of type:[All Files (*)                                   ^][Cancel]β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Demo: filepicker.py (Try Online)

Parameters:
  • path (str, optional) – the current path used in the file dialog, defaults to β€œ.”

  • caption (str, optional) – the title of the dialog, defaults to β€œFile Dialog”

  • filter (str, optional) –

    List of filters separated with β€œ;;”, defaults to β€œAll Files (*)”.

    Example:

    filter="Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
    

  • fileMode (TTkConstant.FileMode, optional) – The file mode defines the number and type of items that the user is expected to select in the dialog, defaults to Anyfile

  • acceptMode (TTkConstant.AcceptMode, optional) – TThe action mode defines whether the dialog is for opening or saving files, defaults to AcceptOpen

TTkButton’s inherited init params:

Parameters:
  • text (str, optional) – the text shown on the button, defaults to β€œβ€

  • border (bool, optional) – the border of the button, defaults to β€œFalse”

  • checked (bool, optional) – checked status if the button is checkable, defaults to β€œFalse”

  • checkable (bool, optional) – define if the button is checkable, 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

Signals🌢️

clicked

This signal is emitted when the button is activated

closed

This signal is emitted whenever the widget is closed

currentStyleChanged

This signal is emitted whenever the widget stye change

filePicked

This signal is emitted whenever any file is picked

focusChanged

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

folderPicked

This signal is emitted whenever any folder is picked

sizeChanged

This signal is emitted whenever the widget size change

toggled

This signal is emitted whenever the button state changes if checkeable, i.e., whenever the user checks or unchecks it.

Slots🌢️

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🌢️

clicked: pyTTkSignal🌢️

This signal is emitted when the button is activated

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

filePicked: pyTTkSignal🌢️

This signal is emitted whenever any file is picked

Parameters:

fileName (str) – the name of the file

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

folderPicked: pyTTkSignal🌢️

This signal is emitted whenever any folder is picked

Parameters:

dirName (str) – the name of the folder

pathPicked: pyTTkSignal🌢️

This signal is emitted whenever any path is picked (Files/Dir)

Parameters:

pathName (str) – the name of the path

sizeChanged: pyTTkSignal🌢️

This signal is emitted whenever the widget size change

Parameters:
  • width (int) – the new widget width

  • height (int) – the new widget height

toggled: pyTTkSignal🌢️

This signal is emitted whenever the button state changes if checkeable, i.e., whenever the user checks or unchecks it.

Parameters:

checked (bool) – True if checked otherwise False

Methods🌢️

acceptMode() AcceptMode[source]🌢️
caption() str[source]🌢️
fileMode() FileMode[source]🌢️
filter() str[source]🌢️
path() str[source]🌢️
setAcceptMode(mode: AcceptMode)[source]🌢️
setCaption(caption: str) None[source]🌢️
setFileMode(fm: FileMode)[source]🌢️
setFilter(filter: str) None[source]🌢️
setPath(path: str) None[source]🌢️

Methods Inherited from: TTkButton

border()

This property holds whether the button has a border

isCheckable()

This property holds whether the button is checkable

isChecked()

This property holds whether the button is checked

keyEvent(evt)

This event handler, can be reimplemented in a subclass to receive key 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.

paintEvent(canvas)

Paint Event callback, this need to be overridden in the widget.

setCheckable(ch)

Enable/Disable the checkable property

setChecked(ch)

Set the checked status

setText(text)

This property holds the text shown on the button

text()

This property holds the text shown on the button

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)

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(width,Β height)

Convenience function, Event Callback triggered after a successful resize

setCurrentStyle(style)

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.

TTkFileButtonPicker Attributes🌢️

classStyle

filesPicked