{"id":17603077,"url":"https://github.com/yjg30737/simplepyqt5","last_synced_at":"2026-05-06T03:31:17.763Z","repository":{"id":57679349,"uuid":"428092801","full_name":"yjg30737/simplePyQt5","owner":"yjg30737","description":"Being able to add a couple of widgets at once and align them easily.","archived":false,"fork":false,"pushed_at":"2022-05-14T10:35:16.000Z","size":76,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-25T19:20:54.234Z","etag":null,"topics":["gui","py37","pyqt","pyqt-examples","pyqt5","pyqt5-examples","pyqt5-tutorial","python","python3","python37","qt"],"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}},"created_at":"2021-11-15T02:04:45.000Z","updated_at":"2024-02-17T23:24:45.000Z","dependencies_parsed_at":"2022-08-24T19:21:10.399Z","dependency_job_id":null,"html_url":"https://github.com/yjg30737/simplePyQt5","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2FsimplePyQt5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2FsimplePyQt5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2FsimplePyQt5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2FsimplePyQt5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yjg30737","download_url":"https://codeload.github.com/yjg30737/simplePyQt5/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239680985,"owners_count":19679509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["gui","py37","pyqt","pyqt-examples","pyqt5","pyqt5-examples","pyqt5-tutorial","python","python3","python37","qt"],"created_at":"2024-10-22T13:39:12.457Z","updated_at":"2025-12-14T03:30:16.046Z","avatar_url":"https://github.com/yjg30737.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simplePyQt5\nThis is the package i used when i was new at PyQt5.\n\nI uploaded this to pypi for the sake of preventing dependency error of some packages. \n\n## Table of Contents\n* [General Info](#general-info)\n* [Requirements](#requirements)\n* [Class Overview](#class-overview)\n* [Setup](#setup)\n* [Usage](#usage)\n\n## General Info\nBeing able to add a couple of Qt widgets and separator at once, align them easily, no need to make layout.\nThis package can come in handy to someone who want to make prototype UI quick.\nI used it all the times when i was new at PyQt5.\n\n## Requirements\n* PyQt5\n\n## Class Overview\n* HorizontalWidget\n\nAdd widgets and separators horizontally.\n\n* VerticalWidget\n\nAdd widgets and separators vertically.\n\n* LeftRightWidget\n\nAdd some widgets left side of the widget and add the others right side.\nUnlike QFormLayout which only can set QLabel to the one side, You can add a bunch of other stuffs like QComboBox, QCheckBox.\n\n* TopLeftRightWidget\n\nThis module inherits LeftRightWidget.\nTop of this widget is LeftRightWidget and bottom part of this you can add/set a bunch of widgets such as QListWidget or separators.\n\n* TopLabelBottomWidget\n\nIf you want to add the label on the top of the TopLeftRightWidget, This is for you.\nUsing `setLabel(text: str)` method to set the label.\n\n* OkCancelWidget\n\nAdd Ok, Cancel buttons to bottom right of certain QDialog. Attach to parent widget like `OkCancelWidget(self)` and then add to parent widget's layout like `lay.addWidget(okCancelWidget)` then ok, cancel buttons will show up bottom right part of the widget.\n\n※ This only works in QDialog!\n\n* InsertDialog\n\nBasic dialog to insert the text. It contains QLineEdit, QPushButton. if user insert the text in QLineEdit, QPushButton will be enabled to click. If QLineEdit is empty, QPushButton will be disabled.\n\n* TableWidget\n\nAdding row items or column items much easier then usual QTableWidget. No need to make QTableWidgetItem. Header labels always be align in center.\nBoth horizontal and vertical headers are not visible in default. But you can use `setHorizontalHeaderLabels(lst)` to add header labels(it will set column count by amount of header labels you given at the same time, align headers as center also.). same goes to vertical one.\n\n※ Maybe i'll make this as independent package. Don't give me wrong; I won't remove this module from this package.\n※ A lot of things that doesn't explain will be explained. Sorry 'bout that.\n\n* StyleApplier\n\nThis module help you apply style, icon, tooltip over widgets. Style path and icon path are set to `style` and `icon` folder in your script folder by default. So if you want to use this module you have to make those two and put the css files and icon files inside them.\nYou can change those two paths, though.\n\n## Setup\n`python -m pip install simplePyQt5`\n\n## Usage\n* HorizontalWidget\n\nCode\n```python\n    from simplePyQt5.horizontalWidget import HorizontalWidget\n    ...\n    horizontalWidget = HorizontalWidget()\n    btn1 = QPushButton('btn1')\n    btn2 = QPushButton('btn2')\n    # Add two buttons horizontally, \"''\" between to buttons is separator, align parameter make widgets align\n    horizontalWidget.addWidgets([btn1, '', btn2], align=Qt.AlignCenter)\n```\nResult\n\n![HorizontalWidget](./examples/horizontalWidgetExample.png)\n\n* VerticalWidget\n\nCode\n\nSame as HorizontalWidget. Only difference is name.\n\nResult\n\n![VerticalWidget](./examples/verticalWidgetExample.png)\n\n* LeftRightWidget\n```python\n    from simplePyQt5.leftRightWidget import LeftRightWidget\n    ...\n    lrWidget = LeftRightWidget()\n    lineEdit = QLineEdit()\n    lineEdit.setFixedWidth(80) # Prevent width of lineEdit grow endlessly to show this modules feature\n    btn = QPushButton()\n    lrWidget.setLeftWidgets([lineEdit]) # Add lineEdit left side of the lrWidget\n    lrWidget.setRightWidgets([btn]) # Add btn right side of the lrWidget\n```\nResult\n\n![LeftRightWidget](./examples/leftRightWidgetExample.png)\n\n* TopLeftRightWidget\n\nAs i said this inherits LeftRightWidget so its usage is kinda simillar to LeftRightWidget.\n\nCode\n```python\n    from simplePyQt5.topLeftRightWidget import TopLeftRightWidget\n    ...\n    tlrWidget = TopLeftRightWidget()\n    lbl = QLabel('Files')\n    addBtn = QPushButton('Add')\n    delBtn = QPushButton('Delete')\n    listWidget = QListWidget()\n    tlrWidget.setLeftWidgets([lbl])\n    tlrWidget.setRightWidgets([addBtn, delBtn])\n    tlrWidget.addBottomWidget(listWidget)\n```\nResult\n\n![TopLeftRightWidget](./examples/topLeftRightWidgetExample.png)\n\n* StyleApplier\n\nUsing TopLeftRightWidget as showing StyleApplier's feature.\n\nCode\n```python\n    from simplePyQt5.styleApplier import StyleApplier\n    ...\n    tlrWidget = TopLeftRightWidget()\n    lbl = QLabel('Files')\n    addBtn = QPushButton()\n    delBtn = QPushButton()\n\n    btns = [addBtn, delBtn]\n    applier = StyleApplier()\n    applier.setCssFile('style1.css', btns) # apply css file to btns list \n    applier.setIconAutomatically(['add.png', 'delete.png'], btns) # apply icon files to btns list\n    applier.setToolTip(['Add', 'Delete'], btns) # apply tooltips to btns list\n\n    listWidget = QListWidget()\n    tlrWidget.setLeftWidgets([lbl])\n    tlrWidget.setRightWidgets([addBtn, delBtn])\n    tlrWidget.addBottomWidget(listWidget)\n```\nResult\n\n![StyleApplier](./examples/styleApplierExample.png)\n\nAgain, Style path and icon path are set to `style` and `icon` folder in your script folder by default. So if you want to use this module you have to make those two and put the css files and icon files inside them.\n\nYou can change those two default paths with `setStylePath` and `setIconPath` method.\n\nIf you want to apply css code itself over widgets instead of file, use `setCssCode` method.\n\nIf you want to adjust widgets' size to icons' size naturally, use `setHintSize` method.\n\n* TopLabelBottomWidget\n\nCode(Full)\n```python\nimport sys\n\nfrom PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication, QListWidget, QCheckBox\nfrom simplePyQt5 import StyleApplier\nfrom simplePyQt5.topLabelBottomWidget import TopLabelBottomWidget\n\n\nclass MainWindow(QMainWindow):\n    def __init__(self):\n        super().__init__()\n        self.__initUi()\n\n    def __initUi(self):\n        mainWidget = TopLabelBottomWidget()\n        mainWidget.setLabel('Files')\n\n        allChkBox = QCheckBox('Check All')\n\n        addBtn = QPushButton()\n        delBtn = QPushButton()\n\n        btns = [addBtn, delBtn]\n        applier = StyleApplier()\n        applier.setCssFile('style1.css', btns)\n        applier.setIconAutomatically(['add.png', 'delete.png'], btns)\n        applier.setToolTip(['Add', 'Delete'], btns)\n\n        listWidget = QListWidget()\n        mainWidget.setLeftWidgets([allChkBox])\n        mainWidget.setRightWidgets([addBtn, delBtn])\n        mainWidget.addBottomWidget(listWidget)\n        lay = mainWidget.layout()\n        lay.setContentsMargins(5, 5, 5, 5)\n        self.setCentralWidget(mainWidget)\n\n\nif __name__ == \"__main__\":\n    app = QApplication(sys.argv)\n    mainWindow = MainWindow()\n    mainWindow.show()\n    sys.exit(app.exec_())\n```\n\nResult\n\n![TopLabelBottomWidget](./examples/topLabelBottomWidgetExample.png)\n\n* OkCancelWidget\n\nAdd OkCancelWidget to TopLabelBottomWidget example code.\n\nCode\n```python\n        listWidget = QListWidget()\n        mainWidget.setLeftWidgets([allChkBox])\n        mainWidget.setRightWidgets([addBtn, delBtn])\n        mainWidget.addBottomWidget(listWidget)\n        \n        okCancelWidget = OkCancelWidget(self) # make OkCancelWidget instance\n        mainWidget.addBottomWidget(okCancelWidget) # attach\n        \n        lay = mainWidget.layout()\n        lay.setContentsMargins(5, 5, 5, 5)\n        self.setCentralWidget(mainWidget)\n```\nResult\n\n![OkCancelWidget](./examples/okCancelWidgetExample.png)\n\nWell, You might think result image looks quite different than the others. Because i write `lay.setContentMargins(5, 5, 5, 5)` to make it less ugly.\nI kinda regret that i didn't set the contents margins to other examples. Whatever.\n\n* InsertDialog\n\nCode\n```python\n\naddBtn = QPushButton()\naddBtn.clicked.connect(self.__add) # Show InsertDialog when addBtn clicked\ndelBtn = QPushButton()\n...\ndef __add(self):\n    dialog = InsertDialog() # make instance\n    reply = dialog.exec()\n    if reply == QDialog.Accepted: # if user clicked ok button in InsertDialog \n        print(dialog.getText()) # get the text\n\n```\nResult\n\n![InsertDialog](./examples/insertDialogExample.png)\n\n* TableWidget\n\nCode(Horizontal)\n```python\ntableWidget = TableWidget()\ntableWidget.setHorizontalHeaderLabels(['Name', 'Sex', 'Age']) # Add labels. the method overrides the setHorizontalHeaderLabels of QTableWidget.\ntableWidget.addData(['a', 'b', 'c'], align=Qt.AlignCenter) # Add data like this. 'a', 'b', 'c' will be added as QTableWidgetItem. One row also will be added. You can give an align option.\n```\n\nCode(Vertical)\n```python\ntableWidget = TableWidget()\ntableWidget.setVerticalHeaderLabels(['Name', 'Sex', 'Age'])\ntableWidget.setColumnCount(3) # You have to set column count unlike the horizontal one. Because addData do add row but not add column.\ntableWidget.addData(['a', 'b', 'c'], align=Qt.AlignCenter)\n```\n\n* Other\n\nThese classes' content margins are set to zero as default, so if you want to set the margin then\n```python\n    lrWidget = LeftRightWidget()\n    lay = lrWidget.layout()\n    lay.setContentMargins(5, 5, 5, 5)\n```\nget the widget's layout like this and set content margins or anything such as spacing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjg30737%2Fsimplepyqt5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyjg30737%2Fsimplepyqt5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjg30737%2Fsimplepyqt5/lists"}