pyqt help examples and some other useful objects (overloaded pyqt classes)
Project description
pyqt_templates (current v0.1.1/)
DESCRIPTION_SHORT
pyqt help examples and some other useful objects (overloaded pyqt classes)
DESCRIPTION_LONG
Designed for ...
Features
- 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
Release history Release notifications | RSS feed
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.1.tar.gz
(22.4 kB
view details)
Built Distribution
File details
Details for the file pyqt_templates-0.1.1.tar.gz
.
File metadata
- Download URL: pyqt_templates-0.1.1.tar.gz
- Upload date:
- Size: 22.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5322c14e38b19702a58c3c406b900fb9a64728b4d7076dfa6b927f77e38bab2 |
|
MD5 | 869c0d0e3d0ee2ce7314ddc5d444ad9e |
|
BLAKE2b-256 | 4c18244963e401ebc6428962bfd19f0eb54c882c2cc13f92f14e0c6222c524e7 |
File details
Details for the file pyqt_templates-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pyqt_templates-0.1.1-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b7d0e3f14a7e8034b8045cc873ebc6e0f5f6371a312c3fca2e4a93aee6feb31 |
|
MD5 | ee4d3b7d82cd3b1cd7b7e9120e5781c2 |
|
BLAKE2b-256 | 11a3d58dac1ab328f123ced58361ad01b5a5ed540a1098fee9c5ff1dbf5e3345 |