{"id":15021591,"url":"https://github.com/yjg30737/pyqt-checkbox-table-widget","last_synced_at":"2026-03-11T02:38:58.011Z","repository":{"id":57679322,"uuid":"435467994","full_name":"yjg30737/pyqt-checkbox-table-widget","owner":"yjg30737","description":"PyQt's QTableWidget which has checkbox as first header item","archived":false,"fork":false,"pushed_at":"2024-07-15T01:36:07.000Z","size":32,"stargazers_count":11,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-03T19:25:13.826Z","etag":null,"topics":["pyqt","pyqt-checkbox-table-widget","pyqt-table-widget","pyqt5","pyqt5-checkbox-table-widget","pyqt5-examples","pyqt5-table-widget","pyqt5-tutorial","python","python3","qcheckbox","qt","qtablewidget"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yjg30737.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-06T11:20:03.000Z","updated_at":"2025-08-28T07:33:23.000Z","dependencies_parsed_at":"2024-07-15T02:44:21.992Z","dependency_job_id":null,"html_url":"https://github.com/yjg30737/pyqt-checkbox-table-widget","commit_stats":{"total_commits":22,"total_committers":2,"mean_commits":11.0,"dds":"0.045454545454545414","last_synced_commit":"550bb8d633f1fa0bad2bc5f9c0347b637f7f2de0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yjg30737/pyqt-checkbox-table-widget","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-checkbox-table-widget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-checkbox-table-widget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-checkbox-table-widget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-checkbox-table-widget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yjg30737","download_url":"https://codeload.github.com/yjg30737/pyqt-checkbox-table-widget/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-checkbox-table-widget/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30367817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pyqt","pyqt-checkbox-table-widget","pyqt-table-widget","pyqt5","pyqt5-checkbox-table-widget","pyqt5-examples","pyqt5-table-widget","pyqt5-tutorial","python","python3","qcheckbox","qt","qtablewidget"],"created_at":"2024-09-24T19:56:45.975Z","updated_at":"2026-03-11T02:38:57.981Z","avatar_url":"https://github.com/yjg30737.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyqt-checkbox-table-widget\nPyQt's QTableWidget which has checkbox as first header item\n\n## Requirements\nPyQt5 \u003e= 5.8\n\n## Setup\n`python -m pip install pyqt-checkbox-table-widget`\n\n## Method Overview\nMany methods is changed/overriden because of the fact that check box being used in first column.\n* `setHorizontalHeaderLabels(labels: typing.Iterable[str])` - Sets horizontal header label except for first column (for check box), automatically set the count of the columns based on labels\n* `clearContents(start_r_idx=0)` - Remove all contents including check box from start_r_idx\n* `setDefaultValueOfCheckBox(flag: bool)` - Self-explanatory.\n* `stretchEveryColumnExceptForCheckBox()` - Apply self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) except for first column, which is for check box.\n* `setRowCount(rows: int)`\n* `insertRow(rows: int)`\n* `toggleState(state)` - Toggle every single checkbox. State should be Qt.CheckState. You can see how to use this feature in Code Example 2 below.\n* `getCheckedRows()` - Return the list of indexes of row which are checked.\n* `getUncheckedRows()`\n* `setCheckedAt(idx: int, f: bool)` - If f is True, the check box at idx is checked. f is False, the check box at idx is unchecked.\n* `removeCheckedRows()`\n* `removeUncheckedRows()`\n\n## Example\nCode Example 1\n```python\nfrom PyQt5.QtWidgets import QApplication, QTableWidgetItem\nfrom pyqt_checkbox_table_widget.checkBoxTableWidget import CheckBoxTableWidget\n\nif __name__ == \"__main__\":\n    import sys\n\n    app = QApplication(sys.argv)\n    widget = CheckBoxTableWidget()\n    widget.setRowCount(3)\n    widget.setItem(0, 1, QTableWidgetItem('abc')) # Remember column argument should be at least 1 (if it is zero, item will cover the checkbox cell)\n    widget.show()\n    app.exec_()\n```\n\nResult\n\n![image](https://user-images.githubusercontent.com/55078043/144935820-2acc561c-1c8d-4e39-9d22-5a3da32a47f0.png)\n\nCode Example 2\n```python\nfrom PyQt5.QtCore import Qt\nfrom PyQt5.QtWidgets import QApplication, QTableWidgetItem, QMainWindow, QCheckBox, QVBoxLayout, QWidget\nfrom pyqt_checkbox_table_widget.checkBoxTableWidget import CheckBoxTableWidget\n\n\nclass MainWindow(QMainWindow):\n    def __init__(self):\n        super().__init__()\n        self.__initUi()\n\n    def __initUi(self):\n        allChkBox = QCheckBox('Check all')\n        tableWidget = CheckBoxTableWidget()\n        tableWidget.setRowCount(10)\n        tableWidget.stretchEveryColumnExceptForCheckBox() # stretch every section of tablewidget except for check box section\n        for i in range(tableWidget.rowCount()):\n            item = QTableWidgetItem()\n            item.setTextAlignment(Qt.AlignCenter) # align\n            item.setText(str(i)*50) # text sample\n            tableWidget.setItem(i, 1, item)\n        allChkBox.stateChanged.connect(tableWidget.toggleState) # if allChkBox is checked, tablewidget checkboxes will also be checked \n\n        lay = QVBoxLayout()\n        lay.addWidget(allChkBox)\n        lay.addWidget(tableWidget)\n\n        mainWidget = QWidget()\n        mainWidget.setLayout(lay)\n\n        self.setCentralWidget(mainWidget)\n\n\nif __name__ == \"__main__\":\n    import sys\n\n    app = QApplication(sys.argv)\n    window = MainWindow()\n    window.show()\n    app.exec_()\n```\n\nResult\n\nhttps://user-images.githubusercontent.com/55078043/144937804-958af370-5069-4fe9-870d-ace9838eb483.mp4\n\n## Similar package\n\u003ca href=\"https://github.com/yjg30737/pyqt-checkbox-list-widget.git\"\u003epyqt-checkbox-list-widget\u003c/a\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjg30737%2Fpyqt-checkbox-table-widget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyjg30737%2Fpyqt-checkbox-table-widget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjg30737%2Fpyqt-checkbox-table-widget/lists"}