Status: β FULLY OPERATIONAL (Phase 2 Complete)
TestBuddy is a modern, Python-based OCR (Optical Character Recognition) workbench that turns screenshots into editable text using Tesseract.
- πΈ Screenshot Capture - Integrated Windows Snipping Tool
- π€ OCR Processing - Tesseract-powered text extraction
- βοΈ Rich Text Editing - Edit and refine OCR results
- πΎ Session Management - Create, save, and load OCR sessions
- π Session History - Persistent JSON-based storage
- π€ Export - Save sessions as text files with metadata
- π Image Viewer - View captured images with zoom/pan controls
- βοΈ Configuration - INI-based settings system
- π Activity Logging - Complete action audit trail
- Splash Screen - Professional 900ms startup animation
- Home Dashboard - Recent and all sessions lists
- New Session Dialog - Create sessions with metadata (name, category, tags)
- Workbench - Dual-panel layout (image + text editor)
- Toolbar - Quick access to capture, save, export, and zoom controls
- Status Bar - Real-time feedback on OCR processing
- Non-blocking OCR - QThread-based processing keeps UI responsive
- Clipboard Polling - Automatic image detection (500ms intervals)
- Type Hints - 100% Python type annotation coverage
- Error Handling - Comprehensive exception management
- Logging - Detailed audit log for debugging
- Python 3.10+
- Windows (Snipping Tool integration)
- Tesseract OCR binary
cd c:\Users\idavi\Documents\Projects\testbuddy
pip install -r requirements.txtWhat gets installed:
- PyQt6 6.7.0+ (GUI framework)
- Pillow 10.0+ (Image processing)
- pytesseract 0.3.10+ (OCR wrapper)
Download and install from: https://github.com/UB-Mannheim/tesseract/wiki
Default installation path: C:\Program Files\Tesseract-OCR\tesseract.exe
If installed elsewhere, update testbuddy.ini:
[ocr]
tesseract_path = C:\Your\Path\To\tesseract.exepython test_suite.pyExpected output:
Result: 5/5 tests passed
All tests passed! App is ready for use.
python run.pyOr directly:
python app.py- Splash Screen appears (900ms auto-timeout)
- Home Page shows with "+ New Session" button
- Create Session:
- Click "+ New Session"
- Enter: Name = "My First OCR"
- Optionally set Category and Tags
- Click OK
- Capture Screenshot:
- Click "π· Capture" button
- Windows Snipping Tool opens
- Draw rectangle around text
- Copy to clipboard (Ctrl+C)
- OCR Processing:
- App detects clipboard image automatically
- Tesseract processes in background (2-10 sec)
- Text appears in right panel
- Edit & Save:
- Review/fix OCR result
- Click "πΎ Save" to persist to history
- Export (Optional):
- Click "π€ Export" to save as .txt file
testbuddy/
βββ app.py # Main integrated application (520+ lines)
βββ config.py # Configuration management system
βββ history.py # Session persistence and search
βββ main.py # Phase 1 reference implementation
βββ run.py # Application launcher with checks
βββ test_suite.py # Comprehensive functional tests
β
βββ testbuddy.ini # Settings file (auto-created)
βββ testbuddy_history.json # Session database (auto-created)
βββ testbuddy.log # Activity log (auto-created)
βββ export/ # Exported text files directory
β
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ docs/
βββ QUICKSTART_V2.md # User quick start guide
βββ PHASE2_INTEGRATION.md # Integration documentation
βββ INTEGRATION_SUMMARY.md # Technical deep-dive
βββ COMPLETE_SUMMARY.md # Project completion report
Settings are stored in testbuddy.ini and automatically created on first run.
OCR Options:
[ocr]
tesseract_path = C:\Program Files\Tesseract-OCR\tesseract.exe
language = eng # Language code (eng, fra, deu, etc.)
psm = 3 # Page segmentation mode (1-13)
oem = 3 # OCR engine mode (0-3)UI Options:
[ui]
clipboard_poll_interval_ms = 500 # Image detection frequency
export_directory = export/ # Where to save exportsHistory Options:
[history]
enable_history = true # Enable session persistence
file = testbuddy_history.json # Session database file
max_entries = 100 # Maximum sessions to keepLogging:
[behavior]
enable_logging = true # Enable activity logging
log_file = testbuddy.log # Log file pathEdit testbuddy.ini:
[ocr]
language = fra # French
language = deu # German
language = spa # SpanishSee Tesseract docs for all supported language codes.
| Shortcut | Action |
|---|---|
Ctrl+N |
New Session |
Ctrl+S |
Save Session |
Alt+F4 |
Close App |
- π· Capture - Launch Snipping Tool and OCR
- πΎ Save - Save session to history
- π€ Export - Export text to file
- π+ - Zoom in on image
- π- - Zoom out from image
- βΊ Fit - Fit image to window
- Create session with metadata
- Capture screenshot via Snipping Tool
- OCR processes automatically
- Edit text in editor
- Save to history database
- Export as text file
- Reload anytime from Home page
- Name - Display name (required, max 120 chars)
- Category - Classification (General, Project, Receipt, Invoice)
- Tags - Custom labels (comma-separated)
- Created - Auto-set on creation
- Modified - Auto-updated on save
python test_suite.pyTests cover:
- β Dependency verification
- β Configuration loading
- β History persistence
- β Session creation
- β File I/O operations
- Open any document with text
- Take screenshot with Snipping Tool
- Copy to clipboard
- Click Capture in TestBuddy
- Verify OCR result
Error: Tesseract binary not found at configured path
Solution:
- Install Tesseract: https://github.com/UB-Mannheim/tesseract/wiki
- Update path in
testbuddy.ini:tesseract_path = C:\Your\Path\To\tesseract.exe - Restart app
Error: OCR fails with "No image found in clipboard"
Solution:
- Ensure Snipping Tool actually copied the image (usually automatic)
- Try: Windows Snipping Tool β Take screenshot β Copy β Capture button
- Verify clipboard has image: paste into Paint or Word
Error: Text extraction is inaccurate or unreadable
Solutions:
-
Improve image quality:
- Better lighting when taking screenshot
- Higher contrast text on background
- Larger text (zoom in before capturing)
-
Adjust OCR settings in
testbuddy.ini:psm = 6 # Try different page segmentation modes (1-13)
-
Change language if needed:
language = fra # For French text
Error: Saved sessions don't show up in Home page
Solution:
- Verify
enable_history = trueintestbuddy.ini - Check
testbuddy_history.jsonexists - Check
testbuddy.logfor errors - Restart app
Error: Application crashes immediately
Solutions:
- Verify all dependencies:
python test_suite.py - Check
testbuddy.logfor error details - Delete
testbuddy.iniand let app recreate it - Ensure Python 3.10+ installed
Main Thread (UI Loop)
βββ HomePage (renders sessions)
βββ Workbench (image viewer + text editor)
βββ OCRWorker (QThread)
βββ Tesseract processing (non-blocking)
Capture Button
β
Snipping Tool (subprocess)
β
Clipboard Poll (QTimer every 500ms)
β
Image Detected
β
OCRWorker Thread Spawn
β
pytesseract.image_to_string()
β
Finished Signal
β
Text Display in Editor
- Configuration:
testbuddy.ini(INI format) - Sessions:
testbuddy_history.json(JSON format) - Exports:
export/{name}_{timestamp}.txt(Plain text) - Logs:
testbuddy.log(Text format)
| Operation | Time | Notes |
|---|---|---|
| App startup | <2s | Includes 900ms splash screen |
| Config load | <100ms | Parse INI file |
| History load | <200ms | Load 50 sessions |
| OCR (simple) | 2-5s | Basic text recognition |
| OCR (complex) | 5-10s | Complex layouts, fonts |
| Session save | <100ms | Write to JSON |
| Export | <500ms | File I/O |
- Splash screen with auto-timeout
- Home dashboard with session lists
- New session dialog with validation
- Workbench with dual-panel layout
- Image viewer with zoom/pan controls
- Rich text editor with character count
- Capture via Windows Snipping Tool
- Clipboard polling and image detection
- Non-blocking OCR processing (QThread)
- Session persistence to JSON
- Session export as text
- Configuration management (INI)
- Activity logging (testbuddy.log)
- Keyboard shortcuts (Ctrl+N, Ctrl+S)
- Status bar with real-time feedback
- PDF export (image + OCR text)
- Undo/Redo in text editor
- Find & Replace functionality
- Dark mode toggle
- Batch processing
- Session search and filter
- OCR confidence scores
- Multi-language detection
To extend TestBuddy:
- Add Features: Edit
app.py(MainWindow class) - Change Settings: Modify
config.pyandtestbuddy.ini - Improve OCR: Adjust pytesseract parameters in
app.pyOCRWorker - Test Changes: Run
python test_suite.py
Open source - free to use and modify
- Check
testbuddy.logfor error details - Review
PHASE2_INTEGRATION.mdfor detailed docs - Run
python test_suite.pyto validate setup - Verify Tesseract installation
# Launch app
python run.py
# Run tests
python test_suite.py
# Check dependencies
python -c "from config import *; from history import *; print('OK')"
# View recent log entries
type testbuddy.log | Select-Object -Last 10 # PowerShell
tail testbuddy.log # Unix-likeVersion: 2.0 (Phase 2 Complete) Status: β Production Ready Last Updated: December 2025 Test Coverage: 5/5 tests passing Type Hints: 100% coverage
- π Quick Start Guide
- π§ Configuration Guide
- π Integration Details
- ποΈ Technical Deep-Dive
- π Project Summary
Ready to start? Run python run.py now! π