A simple, modern, and extensible template for creating GUI applications with PyQt6. It features a theming system with dark and light modes, where icons automatically adapt to the selected color scheme.
- Adaptive Theming & Dynamic Icons: Seamlessly switch between Dark and Light themes, icons automatically adapt to the selected color scheme.
- Qt Designer Ready: The UI is built using
.uifiles, making it easy to visually edit layouts without touching Python code. - CSS Styling: Themes are defined in standard
.cssfiles for easy customization. - Typography: Uses the JetBrains Mono font, chosen because i like it.
- Python 3.x
pip
-
Clone the repository:
git clone https://github.com/crowdedmovie/pyqt6_gui_template.git cd pyqt6_gui_template -
Install dependencies:
pip install PyQt6
-
Run the application:
python main.py
- Open
gui/gui_interface.uiin Qt Designer to modify the user interface. - After modifying the
.uifile, regenerate the Python code:- Using the build script:
python gui/build.py
- Or manually via CLI:
pyuic6 -x gui/gui_interface.ui -o gui/gui_interface.py
- Using the build script:
The application uses a .qrc file to manage icons. If you add new icons, you must recompile this file.
-
For PyQt6:
pyrcc6 icons/breeze.qrc -o icons/resources_rc.py
-
For PySide6:
pyside6-rcc icons/breeze.qrc -o icons/resources_rc.py
Note: If using PySide6 tools, remember to change the import in the generated file from
PySide6toPyQt6. -
On Windows (Alternative): You can use
rcc.exe, typically found in%LOCALAPPDATA%\Programs\Python\Python313\Lib\site-packages\qt6_applications\Qt\bin.rcc.exe -g python icons/breeze.qrc -o icons/resources_rc.py
To enable automatic icon switching between dark and light themes, you must set a custom property in Qt Designer for any widget with an icon.
- Property Name:
icon_name - Value: The filename of the icon (without path or extension).
- Example: For
icons/light/cancel.svgandicons/dark/cancel.svg, seticon_nametocancel.
- Example: For
Note: Both light and dark icon folders must contain a file with the same name.
The following widgets have custom styling defined in the CSS files:
- Containers:
QMainWindow,QWidget,QGroupBox,QScrollArea,QTabWidget,QTabBar - Controls:
QPushButton,QCheckBox,QRadioButton,QSlider,QProgressBar - Input:
QLineEdit,QTextEdit,QPlainTextEdit,QSpinBox,QDoubleSpinBox,QComboBox - Views:
QTableWidget,QListWidget,QTreeWidget,QHeaderView - Menus:
QMenuBar,QMenu - Misc:
QScrollBar,QToolTip
These widgets inherit default styles:
QLabel,QToolBar,QStatusBarQDial,QLCDNumberQDateTimeEdit,QCalendarWidget
main.py: The application entry point.gui/main_window.py: Contains the core logic, signal connections, and theme switching implementation.gui/gui_interface.ui: The visual layout file (editable in Qt Designer).themes/: Contains thedark.cssandlight.cssstylesheets.
Icons are from BreezeStyleSheets.
This project is licensed under the GPLv3 License - see the LICENSE file for details.

