Pyqt Dialogs logo

Pyqt Dialogs

Organization
CodeAtCode
pyqt-dialogs

Use when implementing PyQt/PySide6 dialogs - standard dialogs (QFileDialog, QMessageBox, QInputDialog, QColorDialog, QFontDialog), custom QDialog patterns, modal vs modeless dialogs, input validation, Qt 6 dialog APIs

Overview

PublisherCodeAtCode
Repositoryoss-ai-skills
Skill namepyqt-dialogs
Stars
30
Forks
3
Bundled files
4
LicenseGPL-3.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by CodeAtCode on GitHub. Read the source before you install it.

Installation

Install the Pyqt Dialogs AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/CodeAtCode/oss-ai-skills/tree/master/frameworks/pyqt/dialogs
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/CodeAtCode/oss-ai-skills.git /tmp/oss-ai-skills
mkdir -p .claude/skills
cp -r /tmp/oss-ai-skills/frameworks/pyqt/dialogs .claude/skills/pyqt-dialogs
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Pyqt Dialogs in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Pyqt Dialogs on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Pyqt Dialogs is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

PyQt Dialogs

Standard and custom dialog patterns for PyQt/PySide6 applications.

Objective: Use this skill to reduce modal-deadlock incidents, rejected-input data loss, dialog-sizing regressions, native-vs-custom dialog mismatches by enforcing modal discipline (exec() vs open()), validation-at-boundary rules, and QDialogButtonBox usage patterns.

Modal vs Modeless Discipline

Use exec() for modal dialogs because open() returns immediately and callers race to access results before the user responds.

Use show() for modeless dialogs because blocking the UI prevents user interaction with other windows (search dialogs, find/replace).

python
# ✅ Modal - blocks until user responds
dialog = MyDialog(parent)
if dialog.exec() == QDialog.Accepted:
    values = dialog.get_values()  # Safe: user has already responded

# ❌ BAD - race condition
dialog = MyDialog(parent)
dialog.open()  # Returns immediately
values = dialog.get_values()  # May read stale data before user responds

# ✅ Modeless - stays open, emits signals
dialog = SearchDialog(parent)
dialog.searchRequested.connect(self.perform_search)
dialog.show()  # Non-blocking

Standard Dialogs — Decision Guide

When to Use Each Dialog Type

  • QFileDialog — File/directory selection. Use static methods for simple cases; subclass for custom behavior.
  • QMessageBox — Confirmation, warnings, errors. Use static methods for quick yes/no/information.
  • QInputDialog — Simple user input (text, number, selection). Use when you need a single value.
  • QColorDialog / QFontDialog — Color/font selection. Use native dialogs for consistency.
  • Custom QDialog — Complex input, multi-field forms, multi-page wizards.

API Reference Relocation

See references/qfiledialog-apis.md for QFileDialog static method syntax. See references/qmessagebox-apis.md for QMessageBox button flags and message types. See references/qinputdialog-apis.md for QInputDialog input modes. See references/color-font-dialogs.md for QColorDialog and QFontDialog APIs.

Custom Dialogs

Basic Custom Dialog Pattern

Do subclass QDialog because standard dialogs cannot handle complex multi-field forms or custom validation logic.

python
from PySide6.QtWidgets import (
    QDialog, QVBoxLayout, QHBoxLayout, QLabel,
    QLineEdit, QDialogButtonBox, QFormLayout
)

class InputDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("Input Dialog")
        self.setMinimumWidth(400)  # Prevent undersizing
        
        layout = QVBoxLayout(self)
        
        # Form
        form = QFormLayout()
        self.name_edit = QLineEdit()
        self.email_edit = QLineEdit()
        form.addRow("Name:", self.name_edit)
        form.addRow("Email:", self.email_edit)
        layout.addLayout(form)
        
        # Buttons - use QDialogButtonBox for correct platform ordering
        buttons = QDialogButtonBox(
            QDialogButtonBox.StandardButton.Ok |
            QDialogButtonBox.StandardButton.Cancel
        )
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        layout.addWidget(buttons)
    
    def get_values(self):
        return {
            "name": self.name_edit.text(),
            "email": self.email_edit.text()
        }

# Usage
dialog = InputDialog(parent)
if dialog.exec() == QDialog.Accepted:
    values = dialog.get_values()

Validation at Boundary

Do validate in try_accept() before calling accept() because accepted dialogs with invalid data propagate errors downstream and force callers to handle bad state.

python
class ValidatedDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("Validated Input")
        
        layout = QVBoxLayout(self)
        
        form = QFormLayout()
        self.age_spin = QSpinBox()
        self.age_spin.setRange(0, 120)
        self.email_edit = QLineEdit()
        form.addRow("Age:", self.age_spin)
        form.addRow("Email:", self.email_edit)
        layout.addLayout(form)
        
        # Error label - show validation feedback
        self.error_label = QLabel()
        self.error_label.setStyleSheet("color: red;")
        layout.addWidget(self.error_label)
        
        # Connect OK button to validation wrapper
        self.buttons = QDialogButtonBox(
            QDialogButtonBox.StandardButton.Ok |
            QDialogButtonBox.StandardButton.Cancel
        )
        self.buttons.accepted.connect(self.try_accept)  # NOT self.accept
        self.buttons.rejected.connect(self.reject)
        layout.addWidget(self.buttons)
    
    def try_accept(self):
        """Validate before accepting — prevents invalid state propagation."""
        if not self.validate():
            return  # Block accept() if validation fails
        self.accept()
    
    def validate(self):
        email = self.email_edit.text()
        if not email:
            self.error_label.setText("Email is required")
            return False
        
        if not re.match(r"[^@]+@[^@]+\.[^@]+", email):
            self.error_label.setText("Invalid email format")
            return False
        
        self.error_label.clear()
        return True

Modeless Dialog Pattern

Do use signals for modeless dialogs because the dialog needs to communicate results without blocking the parent or requiring polling.

python
class SearchDialog(QDialog):
    """Non-modal dialog that stays open and emits results via signals."""
    searchRequested = Signal(str)
    
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("Search")
        # Set window flags for modeless behavior
        self.setWindowFlags(
            Qt.WindowType.Dialog |
            Qt.WindowType.WindowCloseButtonHint
        )
        
        layout = QVBoxLayout(self)
        
        self.search_edit = QLineEdit()
        self.search_edit.setPlaceholderText("Enter search term...")
        self.search_edit.returnPressed.connect(self.search)
        
        self.search_btn = QPushButton("Search")
        self.search_btn.clicked.connect(self.search)
        
        layout.addWidget(self.search_edit)
        layout.addWidget(self.search_btn)
    
    def search(self):
        term = self.search_edit.text()
        if term:
            self.searchRequested.emit(term)  # Signal result to parent

# Usage
search_dialog = SearchDialog(parent)
search_dialog.searchRequested.connect(parent.perform_search)
search_dialog.show()  # Non-modal — dialog stays open

Best Practices

  1. Use QDialogButtonBox for standard buttons because it ensures correct button ordering per platform (OK/Cancel order varies by OS).

  2. Always provide Cancel button because users need an escape path; dialogs without cancel trap users in error states.

  3. Pass parent to all dialogs because dialogs without parents become orphaned windows that can appear behind main windows or lose modality.

  4. Set minimum size on custom dialogs because dialogs that are too small truncate content and create poor UX.

  5. Validate before accept() because downstream code assumes dialog data is valid after QDialog.Accepted.

  6. Use exec() for modal, show() for modeless because mixing them causes race conditions (exec() blocks, show() doesn't).

Qt 6 Modern Patterns

QDialog Setup Pattern

python
class MyDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle("Settings")
        self.setModal(True)
        
        layout = QVBoxLayout()
        # ... widgets ...
        
        # Use setLayout() instead of layout = ...; self.setLayout(layout)
        self.setLayout(layout)
        
        # Standard button box
        btn_box = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel
        )
        btn_box.accepted.connect(self.accept)
        btn_box.rejected.connect(self.reject)
        layout.addWidget(btn_box)

Deep Dives

For detailed API reference, see the following files loaded on demand:

  • references/qfiledialog-apis.md — QFileDialog static methods and options
  • references/qmessagebox-apis.md — QMessageBox button flags and message types
  • references/qinputdialog-apis.md — QInputDialog input modes
  • references/color-font-dialogs.md — QColorDialog and QFontDialog APIs

References

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Pyqt Dialogs AI skill do?

Use when implementing PyQt/PySide6 dialogs - standard dialogs (QFileDialog, QMessageBox, QInputDialog, QColorDialog, QFontDialog), custom QDialog patterns, modal vs modeless dialogs, input validation, Qt 6 dialog APIs

Why use Pyqt Dialogs on TypingMind?

Because you install it once and use it with any model. Pyqt Dialogs is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Pyqt Dialogs in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/CodeAtCode/oss-ai-skills/tree/master/frameworks/pyqt/dialogs. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Pyqt Dialogs?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Pyqt Dialogs?

As many as you like. As long as a model supports skills, you can use Pyqt Dialogs with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Pyqt Dialogs AI skill free?

Yes. It is published on GitHub by CodeAtCode under the GPL-3.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇