Overview
The desktop application (desktop_app.py) provides a native window experience by embedding the web interface in a desktop application. It supports two backend frameworks:
- PyQt6 + QtWebEngine - Full-featured Chromium-based browser with GPU acceleration
- pywebview - Lightweight alternative using the system’s native webview
Prerequisites
- Python 3.8 or higher
- Google Service Account credentials
- One of the following UI backends:
- PyQt6 + PyQt6-WebEngine (recommended)
- pywebview
Installation
How It Works
The desktop application:- Configures GPU acceleration - Applies Chromium flags for optimal video playback
- Starts embedded HTTP server - Runs
server.pyin a background thread - Creates native window - Opens PyQt6 or pywebview window pointing to
http://127.0.0.1:<port> - Manages lifecycle - Shuts down server when window closes
Architecture
Environment Variables
Host address for the embedded server. Desktop app defaults to localhost for security.
Server port. If not specified, automatically finds a free port.
Path to application resources (HTML, CSS, JS). Automatically detected.
Where user data is stored (progress, cache). Created in executable directory.
Desktop app defaults to
0 to use the bundled cache and avoid stale external caches.Path to service account credentials. Auto-detected from:
service_account.jsonin executable directoryservice_account.jsonin bundle resources (for compiled apps)
GPU Acceleration
The desktop app automatically configures GPU acceleration for smooth video playback:Chromium Flags (desktop_app.py:27-50)
Platform-Specific Settings
Windows:UI Backends
PyQt6 Backend (Recommended)
Advantages:- Full Chromium browser engine
- Best video codec support
- Hardware acceleration
- Persistent storage and caching
- Developer tools available
pywebview Backend
Advantages:- Smaller memory footprint
- Uses system webview (EdgeHTML/WebKit)
- Simpler installation
- May have codec limitations on some systems
- Less control over rendering engine
Data Storage
The desktop app stores all user data in thePlatziData directory:
Persistence
- Progress tracking - Survives app restarts
- Course cache - Reduces Drive API calls
- Browser state - Cookies, localStorage (PyQt6 only)
Running from Source
Basic Usage
Custom Port
Custom Data Directory
Custom Credentials
Development Mode
Enable PyQt6 Developer Tools
Modifydesktop_app.py to enable DevTools:
Enable pywebview Debug Mode
Troubleshooting
Missing UI Backend Error
Server Won’t Start
- Check if port is in use:
netstat -ano | findstr :8080 - Let the app auto-select a port: Unset
PORTenvironment variable
Video Playback Issues
PyQt6:-
Verify GPU acceleration:
-
Try software rendering:
- Ensure system codecs are installed (Windows Media Feature Pack on Windows N editions)
Window Won’t Close Cleanly
The app attempts to shutdown the server gracefully. If issues persist:Credentials Not Found
The app searches forservice_account.json in:
- Executable directory (desktop_app.py:142)
- Bundle resources (desktop_app.py:143)
GOOGLE_SERVICE_ACCOUNT_FILEenvironment variable
Performance Tips
Memory Usage
- PyQt6: ~150-300 MB (Chromium engine)
- pywebview: ~50-150 MB (system webview)
Startup Time
- First launch: 2-5 seconds (loads course cache)
- Subsequent launches: 1-2 seconds
Reduce Memory Footprint
Building Executables
For distributing the desktop app as a standalone executable, see:Portable Executable
Build standalone executables with PyInstaller
Comparison with Other Deployment Methods
| Feature | Desktop App | Docker | Portable EXE |
|---|---|---|---|
| Installation | Requires Python | Requires Docker | No dependencies |
| Startup Time | Fast (1-2s) | Medium (5-10s) | Fast (2-3s) |
| Memory Usage | 50-300 MB | 100-200 MB | 100-300 MB |
| Native Feel | Yes | No (browser) | Yes |
| Auto-Update | Manual | Pull image | Manual |
| Distribution | Source code | Container | Single .exe |
Next Steps
Docker Deployment
Run in containerized environment
Build Portable EXE
Create standalone Windows executable