A customizable PyQt6 widget displaying a retro 'No Signal' TV animation.
Project description
PyQt6 No Signal Widget
A customizable PyQt6 widget displaying a retro 'No Signal' TV animation using embedded HTML/CSS/JS within a QWebEngineView.
Features
- Retro "No Signal" animation with color bars.
- Floating message box with customizable text, scaling with widget size.
- Customizable colors for all animation elements (color bars, text) using:
- Predefined color names (e.g.,
'bright_red','original_blue'). - Standard CSS color strings (e.g.,
'#FF0000','rgba(0,255,0,0.5)').
- Predefined color names (e.g.,
- Start/Stop controls for the animation with fade-to-black/fade-in effects, including a '⛔️' indicator when stopped.
- Self-contained widget code (
src/pyqt_no_signal_widget/no_signal_widget.py). - Comprehensive example application (
example/NoSignalExampleWindow.py) for testing and demonstration. - Standard Python packaging setup using
pyproject.toml.
Project Structure
PyQtNoSignalWidget/
├── src/
│ └── pyqt_no_signal_widget/
│ ├── __init__.py # Exports NoSignalWidget
│ └── no_signal_widget.py # Widget source code
├── example/
│ └── NoSignalExampleWindow.py # Example GUI
├── pyproject.toml # Build system and package definition
├── README.md # This file
└── requirements.txt # Optional: For development dependencies
Installation
Option 1: From PyPI (Recommended)
pip install pyqt-no-signal-widget
Option 2: From Source (for development)
- Clone this repository.
- Navigate to the project root directory (the one containing
pyproject.toml) in your terminal. - Install in editable mode:
pip install -e .
Basic Usage
import sys
from PyQt6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget
from PyQt6.QtCore import QTimer
# Import the widget from the installed package
from pyqt_no_signal_widget import NoSignalWidget
app = QApplication(sys.argv)
window = QMainWindow()
central_widget = QWidget()
layout = QVBoxLayout(central_widget)
# Create the widget
no_signal = NoSignalWidget(
initial_text="LOADING...",
initial_colors={'--text-color': 'lime', '--red': 'orange'}, # Use names or CSS values
start_active=True # Start animation immediately after load
)
layout.addWidget(no_signal)
window.setCentralWidget(central_widget)
window.setWindowTitle("Basic No Signal Widget")
window.setGeometry(200, 200, 600, 400)
window.show()
# Example interaction after widget loads
def on_load():
print("Widget loaded, stopping in 2s")
QTimer.singleShot(2000, no_signal.stop)
QTimer.singleShot(4000, lambda: no_signal.setText("STOPPED!"))
QTimer.singleShot(6000, no_signal.start)
QTimer.singleShot(8000, lambda: no_signal.setColors({'--text-color': 'white'}))
no_signal.loadFinished.connect(on_load)
sys.exit(app.exec())
Running the Example Application
- Ensure the package is installed (preferably using Option 2:
pip install -e .). - Run the example script from the project root:
python example/NoSignalExampleWindow.py
Dependencies
- PyQt6 >= 6.4.0
- PyQt6-WebEngine >= 6.4.0
Notes
- Rendering Issues: This widget uses
QWebEngineView. If you encounter rendering glitches or C++/GPU-related errors in the console (e.g.,shared_image_factory,skia_output_surface_impl_on_gpu), it might be related to graphics drivers or hardware acceleration compatibility. As a workaround, try disabling GPU acceleration by setting the environment variableQTWEBENGINE_CHROMIUM_FLAGSto--disable-gpubefore running your application.- PowerShell:
$env:QTWEBENGINE_CHROMIUM_FLAGS="--disable-gpu" - cmd.exe:
set QTWEBENGINE_CHROMIUM_FLAGS=--disable-gpu - Bash/Zsh:
export QTWEBENGINE_CHROMIUM_FLAGS="--disable-gpu"
- PowerShell:
- Customization: Explore the
NoSignalWidgetclass methods (setText,setColors,start,stop) and thePREDEFINED_COLORSandDEFAULT_COLORSdictionaries withinno_signal_widget.pyfor customization options.
License
(Specify your chosen license here, e.g., MIT License)
Files
PyQTNoSignalAnimation.py: The source code for theNoSignalWidgetclass.NoSignalExampleWindow.py: A comprehensive example application showcasing widget features.requirements-widget.txt: Dependencies needed to use the widget as a library.requirements-example.txt: Dependencies needed to run the example application.pyproject.toml: Configuration file for building the Python package.build_package.py: Helper script to build the installable package (.whl,.tar.gz).README.md: This documentation file.LICENSE(Optional): Add your chosen license file (e.g., MIT).
Widget Usage (NoSignalWidget)
Installation
Option 1: From Source (using the build script)
- Navigate to the
PyQtNoSignalWidgetdirectory in your terminal. - Run the build script:
python build_package.py - Install the generated wheel file:
pip install dist/*.whl
Option 2: Directly (if not packaging)
Ensure PyQTNoSignalAnimation.py is in your Python path or the same directory as your application script.
Basic Example
import sys
from PyQt6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget
from PyQt6.QtCore import QTimer
# Assuming the widget is installed or PyQTNoSignalAnimation.py is accessible
from PyQTNoSignalAnimation import NoSignalWidget
app = QApplication(sys.argv)
window = QMainWindow()
central_widget = QWidget()
layout = QVBoxLayout(central_widget)
# Create the widget
no_signal = NoSignalWidget(
initial_text="LOADING...",
initial_colors={'--text-color': 'lime', '--red': 'orange'}, # Use names or CSS values
start_active=True # Start animation immediately after load
)
layout.addWidget(no_signal)
window.setCentralWidget(central_widget)
window.setWindowTitle("Basic No Signal Widget")
window.setGeometry(200, 200, 600, 400)
window.show()
# Example interaction after widget loads
def on_load():
print("Widget loaded, stopping in 2s")
QTimer.singleShot(2000, no_signal.stop)
QTimer.singleShot(4000, lambda: no_signal.setText("STOPPED!"))
QTimer.singleShot(6000, no_signal.start)
QTimer.singleShot(8000, lambda: no_signal.setColors({'--text-color': 'white'}))
no_signal.loadFinished.connect(on_load)
sys.exit(app.exec())
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyqt_no_signal_widget-0.1.0.tar.gz.
File metadata
- Download URL: pyqt_no_signal_widget-0.1.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adcbdf5d03fd201e128cc022d5aace097bb159fed4ed22d08c44922bbd3bc955
|
|
| MD5 |
240f379ce5ef7689464915ff12e8666b
|
|
| BLAKE2b-256 |
ea94d9b245ece98237614f4d7309754a81b830844816855b55e4f81dbfcf561d
|
File details
Details for the file pyqt_no_signal_widget-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyqt_no_signal_widget-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3273964337a17bbaa7d349287c5814ee8f0daac844f7a8b057512d08d0cd92f
|
|
| MD5 |
31d5730075e85abe21ea9fb824b5da2e
|
|
| BLAKE2b-256 |
aa68cad516f79d1d8b5c4163edaeb287aa960cbaaaf16e1f0a661e4ec76b74f5
|