Skip to main content

pyqt help examples and some other useful objects (overloaded pyqt classes)

Project description

Ver/TestedPython Ver/Os
repo/Created Commit/Last Tests/GitHubWorkflowStatus Tests/GitHubWorkflowStatus
repo/Size Commit/Count/t Commit/Count/y Commit/Count/m

pyqt_templates (current v0.1.6/Ver/Pypi Latest)

DESCRIPTION_SHORT

pyqt help examples and some other useful objects (overloaded pyqt classes)

DESCRIPTION_LONG

Designed for ...

Features

  1. good template for TableView/Model/Signals

License

See the LICENSE file for license rights and limitations (MIT).

Release history

See the HISTORY.md file for release history.

Installation

pip install pyqt-templates

Import

from pyqt_templates import *

USAGE EXAMPLES

See tests, sourcecode and docstrings for other examples.


1. template-1=IMPORT_BEST.py

import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

2. template-2=QAPP_in_cls.py

import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

from typing import *


# =====================================================================================================================
pass


# =====================================================================================================================
class Gui(QWidget):
    TITLE: str = "[GUI] Universal"
    _QAPP: QApplication = QApplication([])

    def __init__(self):
        super().__init__()

        self.wgt_create()
        self.wgt_main__apply_settings()
        self.slots_connect()

        # GUI SHOW ----------------------------------------------------------------------------------------------------
        self.show()
        exit_code = self._QAPP.exec_()
        if exit_code == 0:
            print(f"[OK]GUI({exit_code=})closed correctly")
        else:
            print(f"[FAIL]GUI({exit_code=})closed INCORRECTLY")
        sys.exit(exit_code)

    def wgt_main__apply_settings(self) -> None:
        # MAIN WINDOW -------------------------------------------------------------------------------------------------
        self.setWindowTitle(self.TITLE)

        self.setMinimumSize(300, 100)
        # self.setMinimumWidth(300)
        # self.setMinimumHeight(100)

        self.resize(300, 100)

    def wgt_create(self) -> None:
        # GRID --------------------------------------------------------------------------------------------------------
        layout_grid = QGridLayout()
        layout_grid.setSpacing(2)
        layout_grid.addWidget(QLabel("STLINK"), 0, 0)
        layout_grid.addWidget(QLabel("0"), 0, 1)
        layout_grid.addWidget(QLabel("1"), 0, 2)

        # START -------------------------------------------------------------------------------------------------------
        self.btn_start = QPushButton("START")
        self.btn_start.setCheckable(True)

        # layout ------------------------------------------------------------------------------------------------------
        layout_main = QVBoxLayout()
        layout_main.addLayout(layout_grid)
        layout_main.addWidget(self.btn_start)
        self.setLayout(layout_main)

    def slots_connect(self) -> None:
        self.btn_start.toggled.connect(self.btn_toggled)

    def btn_toggled(self, _state: Optional[bool] = None) -> None:
        print(f"btn {_state=}")


# =====================================================================================================================
if __name__ == '__main__':
    Gui()


# =====================================================================================================================

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyqt_templates-0.1.6.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

pyqt_templates-0.1.6-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file pyqt_templates-0.1.6.tar.gz.

File metadata

  • Download URL: pyqt_templates-0.1.6.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyqt_templates-0.1.6.tar.gz
Algorithm Hash digest
SHA256 2fca6945ccbb9b5522b91d4faf6dae237bcc43af15b8f8701000e450ef16af9d
MD5 6b1d64d286b87ddd7a440a4835b80b2d
BLAKE2b-256 2d0dd04c41394f5b439273fe6add9de6a9157dbc6ff5be1ac78ac705094792d5

See more details on using hashes here.

File details

Details for the file pyqt_templates-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for pyqt_templates-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 500da8f63a5be6646392e5475b3bfccb4bbffdc4f376d6f969f8e508ca7623cd
MD5 2a7a11475b307aa825ff310557f95d46
BLAKE2b-256 95f05a0a24d91a6b54708e8b6f2943dbbc72876fbdacd18b73fe98b70c14ef36

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page