pyqt-threading

Installation
SKILL.md

Objective: Use this skill to prevent UI freezes, cross-thread crashes, and thread-leak memory bugs by enforcing the worker-object pattern, queued signal connections, and proper thread lifecycle cleanup.

PyQt Threading - Core Patterns

Thread Safety Rules

CRITICAL: Qt/PyQt is NOT thread-safe for UI operations. You MUST follow these rules:

  1. Never access widgets from worker threads - Only the main thread can modify UI
  2. Use signals for cross-thread communication - Emit signals from worker, connect to slots in main thread
  3. Use Qt.QueuedConnection for thread-safe signal delivery - AutoConnection handles this automatically
  4. Never block the main thread - Long operations will freeze the UI
# ❌ WRONG: Direct UI access from thread
class BadWorker(QThread):
    def run(self):
        # This will crash or cause undefined behavior!
        self.label.setText("Done")
Installs
52
GitHub Stars
28
First Seen
Apr 20, 2026