{"id":4429,"library":"aqt","title":"Anki's Qt UI Module","description":"The `aqt` package on PyPI, currently at version 25.9.2, serves as the internal Python module for the Anki flashcard application's graphical user interface. It is built upon the Qt toolkit, primarily through PyQt bindings, and is designed for the development of Anki add-ons and extensions. This package's release cadence is tied directly to the development and release cycle of the Anki application itself, which typically sees frequent updates.","status":"active","version":"25.9.2","language":"en","source_language":"en","source_url":"https://github.com/ankitects/anki/tree/main/aqt","tags":["GUI","Qt","Anki","add-on","flashcards"],"install":[{"cmd":"pip install aqt","lang":"bash","label":"Install `aqt`"}],"dependencies":[{"reason":"Anki's UI is built on Qt, requiring PyQt bindings at runtime. These are typically bundled with Anki.","package":"PyQt5/PyQt6","optional":false}],"imports":[{"note":"Main window object in Anki add-ons","symbol":"mw","correct":"from aqt import mw"},{"note":"Access to Anki's editor interface","symbol":"editor","correct":"from aqt import editor"},{"note":"Access to Anki's browser interface","symbol":"browser","correct":"from aqt import browser"}],"quickstart":{"code":"import aqt\nfrom aqt.utils import showInfo\n\ndef my_anki_addon_action():\n    showInfo(\"Hello from my Anki add-on using aqt!\")\n\n# Example: Add a menu item to Anki's Tools menu\n# This code is typically placed in an Anki add-on's __init__.py\n# This requires Anki's main window (mw) to be available.\n# In a real add-on, 'aqt.mw' is automatically populated.\n# For a standalone runnable example, it would need a mock Anki environment.\n\n# To simulate, if running directly, this part would not execute outside Anki\n# if aqt.mw is None:\n#    print(\"Run this code within Anki for full functionality.\")\n# else:\n#    action = aqt.qt.QAction(\"My Custom Action\", aqt.mw)\n#    action.triggered.connect(my_anki_addon_action)\n#    aqt.mw.form.menuTools.addAction(action)\n","lang":"python","description":"This quickstart demonstrates how to interact with Anki's main window and show a simple info dialog using the `aqt` module, as typically done within an Anki add-on. This code is intended to be run within the Anki application environment, where `aqt.mw` and `aqt.qt` (PyQt bindings) are already initialized."},"warnings":[{"fix":"Ensure you are installing `aqtinstall` if you need the Qt installer, or `aqt` if you are developing Anki add-ons and understand its context.","message":"This `aqt` package (version 25.9.2) is often confused with `aqtinstall`, a completely separate command-line utility for installing Qt binaries. They serve different purposes and are not interchangeable.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use `PyQt` or `PySide` directly for general Qt-based GUI development. Only use `aqt` if you are specifically developing an Anki add-on.","message":"The `aqt` package is primarily an internal module of the Anki application. Its API is not designed for standalone general-purpose GUI development and is subject to change with Anki updates without explicit deprecation cycles for external users.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If developing an Anki add-on, run your code within Anki. For standalone GUI development, explicitly install and use a full Qt binding like `PyQt6` or `PySide6`.","message":"Installing `aqt` via pip does not provide a complete GUI framework for standalone applications. It relies on Anki's bundled Qt/PyQt environment. Attempting to use it outside an active Anki instance will likely result in missing dependencies or uninitialized components.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}