Turn a one-line idea into a fully structured, audience-tuned YouTube script — powered by GPT-4 and wrapped in a modern, animated PyQt6 desktop interface.
YouTube Script Generator is a standalone desktop application that transforms a short video brief (title, duration, audience, tone, keywords) into a professionally structured YouTube script with clear Introduction, Body, and Conclusion sections. Built with PyQt6, it offers a vibrant dark-mode UI, smooth animations, Markdown-rendered output, and one-click export to .txt or .md.
Whether you are a creator, educator, marketer, or developer exploring Qt and LLMs, this tool is designed to be fast, beautiful, and genuinely useful.
- AI-Powered Script Generation: Integrates directly with the OpenAI GPT-4 API to generate high-quality, platform-optimized scripts tailored to your audience and narration style.
- Modern PyQt6 UI: A professionally designed interface with a deep dark-mode theme, vibrant neon-purple and electric-blue accents, rounded corners, and gradient buttons — no stock Windows/Mac look.
- Smooth Animations: Fade-in window transition, animated glow effects on button hover (via
QPropertyAnimation+QGraphicsDropShadowEffect), and an indeterminate gradient progress bar as the loading indicator. - Markdown-Rendered Output: The script appears in a live Markdown view, preserving headings, bold emphasis, lists, and code blocks for effortless readability.
- Interactive Form Controls: Stylized
QSliderfor duration with a live chip readout, editableQComboBoxdropdowns for audience and style, and placeholder-guided text inputs. - Non-Blocking UX: All network calls run on a background
QThread, so the UI stays silky-smooth during generation. - Smart File Export: Save as
.txtor.mdwith automatic, date-stamped file names (e.g.,How_to_Code_2026-04-18.md) inside a managedexports/folder. No overwrites — duplicates get numeric suffixes. - Graceful Offline Mode: If no
OPENAI_API_KEYis configured, the app falls back to a clearly-labeled placeholder script so you can still test the full UI and export pipeline. - Robust Error Handling: Connection failures, invalid keys, and file I/O errors are surfaced through clear, styled dialogs — never a silent crash.
Main window — form, slider, and Markdown output panel
| Category | Technology |
|---|---|
| Language | Python 3.10+ |
| GUI Framework | PyQt6 (QtWidgets, QtCore, QtGui) |
| Styling | Qt Style Sheets (QSS) — custom dark theme with gradients |
| Animations | QPropertyAnimation, QGraphicsDropShadowEffect, QEasingCurve |
| AI Backend | OpenAI API (gpt-4 via the official openai Python SDK) |
| Threading | QThread with signal/slot communication |
| File I/O | pathlib, Markdown-aware export pipeline |
| Packaging | pip + requirements.txt |
- Python 3.10 or newer — python.org/downloads
- A working pip (bundled with modern Python installs)
- (Optional) An OpenAI API key for real GPT-4 generation — platform.openai.com/api-keys
git clone <url>
cd youtube-script-generator# Windows
python -m venv .venv
.venv\Scripts\activate
# macOS / Linux
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtThe app reads the key from the OPENAI_API_KEY environment variable. Without it, the app runs in offline placeholder mode.
Option A — environment variable (recommended)
# Windows (persistent)
setx OPENAI_API_KEY "sk-your-key-here"
# macOS / Linux
export OPENAI_API_KEY="sk-your-key-here"Option B — .env file (local only, never commit)
Create a .env file next to main.py:
OPENAI_API_KEY=sk-your-key-hereThen load it before launching (for example, with python-dotenv or your shell's dotenv support).
python main.pyThe window will fade in with the dark theme applied.
- Fill in the Title / Topic (e.g., "How to Code Your First Python App").
- Drag the Duration slider to your desired length (1–120 minutes).
- Pick or type a Target Audience (e.g., Beginners, Developers).
- Choose a Narration Style from the dropdown (Informative, Entertaining, Technical, Dramatic, ...).
- Add optional Keywords, comma-separated.
- Click Generate Script — the loading bar animates while GPT-4 composes your script.
- Review the rendered Markdown output in the right-hand panel.
- After generation, the app asks whether you want to save.
- Alternatively, pick a format (
txtormd) and click Save to File at any time. - Files are saved to the
exports/folder with smart, date-stamped names:
exports/
├── How_to_Code_2026-04-18.txt
├── How_to_Code_2026-04-18.md
└── How_to_Code_2026-04-18_1.md (automatic suffix if the file already exists)
youtube-script-generator/
├── main.py # Application entry point (GUI + AI + export logic)
├── requirements.txt # Python dependencies
├── README.md # You are here
├── LICENSE # MIT license
├── .gitignore # Git exclusions
├── docs/ # Screenshots, demo GIFs, design notes
└── exports/ # Auto-created on first save
Contributions are warmly welcomed — whether you are fixing a bug, polishing the UI, adding new export formats, or integrating additional AI providers.
- Fork the repository.
- Create a feature branch:
git checkout -b feature/my-improvement - Commit your changes with clear messages:
git commit -m "Add: something useful" - Push to your fork:
git push origin feature/my-improvement - Open a Pull Request and describe the motivation, changes, and any screenshots.
- Keep all code and comments in English.
- Match the existing code style (PEP 8, type hints where helpful).
- Preserve the modular separation between domain logic and GUI layer.
- Include screenshots for any UI-facing change.
- If you add a dependency, update
requirements.txtwith a sensible minimum version.
Found a bug or have an idea? Please open an issue with a clear description, reproduction steps (if applicable), and screenshots where helpful.
- Per-request model picker (GPT-4, GPT-4o, GPT-4 Turbo)
- Temperature & tone sliders
- PDF export via
reportlab - Built-in "Recent Scripts" history panel
- Multi-language script generation
- Thumbnail prompt companion (DALL-E integration)
Distributed under the MIT License. See LICENSE for the full text.
MIT License — Copyright (c) 2026
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
[see LICENSE file for the full terms]
- OpenAI — for the GPT-4 API that powers generation.
- Riverbank Computing and The Qt Company — for PyQt6 and the Qt framework.
- The open-source community — for the countless tools and tutorials that made this project possible.
Built with care for creators who value both content and craft.
If this project helps you, please consider giving it a star.
