Skip to main content

pyqt-image-file-explorer-table-widget

PyQt QTableWidget for image file explorer

Requirements

PyQt5 >= 5.8

Setup

python -m pip install pyqt-image-file-explorer-table-widget

Included Packages

Feature

  • Being able to set column count with setColumnCount(columns: int)

  • Being able to remove selected cells with removeSelectedCells()

  • Set cell padding with setCellPadding(padding: int). No padding by defeault.

  • Set cell margin (set space between cells) with setCellMargin(margin: int) - This doesn't give the space between cells, just looks like it. I will figure it out how to set the space between cells properly. No margin by default.

  • Resize friendly

  • If you want to add grid(no grid by default), use setShowGrid(f: bool) even though this is provided by QTableWidget originally.

  • showTinyImageBigger(f: bool) to expand image which is so small that it's hard to see

Example

import os



from pyqt_image_file_explorer_table_widget.imageFileExplorerTableWidget import ImageFileExplorerTableWidget

from PyQt5.QtWidgets import QWidget, QPushButton, QHBoxLayout, QGridLayout, QFileDialog, QApplication





class ImageFileExplorerExample(QWidget):

    def __init__(self):

        super().__init__()

        self.__initUi()



    def __initUi(self):

        self.__tableWidget = ImageFileExplorerTableWidget()



        addBtn = QPushButton('Add')

        addBtn.clicked.connect(self.__add)



        delBtn = QPushButton('Remove')

        delBtn.clicked.connect(self.__delete)



        lay = QHBoxLayout()

        lay.addWidget(addBtn)

        lay.addWidget(delBtn)

        lay.setContentsMargins(0, 0, 0, 0)



        btns = QWidget()

        btns.setLayout(lay)



        self.__tableWidget.setColumnCount(6)



        lay = QGridLayout()

        lay.addWidget(btns)

        lay.addWidget(self.__tableWidget)

        lay.setContentsMargins(0, 0, 0, 0)



        self.setLayout(lay)



    def __add(self):

        dirname = QFileDialog.getExistingDirectory(self, 'Open directory', '')

        if dirname:

            filenames = [os.path.join(dirname, filename) for filename in os.listdir(dirname)]

            filenames = list(filter(lambda x: os.path.splitext(x)[-1] in ['.png'],

                                    [filename for filename in filenames])) # In this example, png only

            self.__tableWidget.addCells(filenames)



    def __delete(self):

        self.__tableWidget.removeSelectedCells()





if __name__ == "__main__":

    import sys



    app = QApplication(sys.argv)

    imageFileExplorerExample = ImageFileExplorerExample()

    imageFileExplorerExample.show()

    app.exec_()

Result

image

After select add.png, addTab.png, bold.png and remove all of them

image

Metadata

Release files for pyqt-image-file-explorer-table-widget 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyqt-image-file-explorer-table-widget 0.0.1
File Size Uploaded
pyqt-image-file-explorer-table-widget-0.0.1.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyqt-image-file-explorer-table-widget 0.0.1
File Interpreter ABI Platform
pyqt_image_file_explorer_table_widget-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.2 kB

Release files / pyqt-image-file-explorer-table-widget-0.0.1.tar.gz

Download URL pyqt-image-file-explorer-table-widget-0.0.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
eb11b4db8ec51ad0da57ac0fdd2cb0e0e80415ab9055d5fea639f082863b7d74
BLAKE2b-256 checksum
How to use checksums
f0a936b33e2f6a6cbcfcfec01916e4c973db139c845546a9fa1a72e4f4df99f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 CPython/3.7.6

Release files / pyqt_image_file_explorer_table_widget-0.0.1-py3-none-any.whl

Download URL pyqt_image_file_explorer_table_widget-0.0.1-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed30434176683ce1f3303942e877a2d73915bc69faab48a11497769ba16ed9f3
BLAKE2b-256 checksum
How to use checksums
f7ee1623dfaff7fd36ba9875239352f3edfc2cb53c5c8e2d9b4c45d3ebd3c2ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page