A comprehensive benchmarking tool for testing Tkinter/TTK performance across different systems and configurations. This application provides detailed performance metrics for various GUI operations and helps developers optimize their Tkinter applications.
- Treeview Population: Measures performance of adding large numbers of items to TTK Treeview widgets
- Label/Progressbar Updates: Tests rapid UI element update performance
- Window Creation/Destruction: Benchmarks window management performance
- Bulk Widget Creation: Tests creation of large numbers of TTK widgets
- Memory Allocation Testing: Measures memory allocation and deallocation performance
- Theme Switching: Real-time TTK theme changing with support for all available themes
- System Information Display: Shows detailed system specs including CPU, memory, and platform info
- Performance Monitoring: Real-time CPU and memory usage monitoring
- Results Management: Save, load, and export test results in JSON and CSV formats
- Auto-save Functionality: Automatically save results after test completion
- Threading Support: Non-blocking test execution with cancellation support
- Performance Summary: Comprehensive analysis of all test results
- Keyboard Shortcuts: Quick access to common functions
- Results Comparison: Compare multiple test runs to track performance changes
- Stress Testing: Run tests with increased loads and multiple iterations
- HTML Report Generation: Create detailed HTML reports with charts and analysis
- Configuration Management: Customizable default settings and thresholds
- Verbose Output Mode: Detailed logging for debugging and analysis
- Professional Layout: Clean, organized interface with labeled sections
- Progress Tracking: Visual progress indicators during test execution
- Scrollable Results: Scrollable areas for large datasets and detailed results
- Context Menus: Full menu system with File, Tools, and Help options
- Responsive Design: Adaptive layout that works on different screen sizes
- Python 3.8 or higher
- Tkinter (usually comes with Python)
- psutil (for system monitoring)
- Clone or download the repository:
git clone <repository-url>
cd python_ttk- Install required dependencies:
pip install psutil- Run the application:
python main.py-
Treeview Test:
- Set the number of items to populate (default: 1000)
- Click "Test Treeview Population"
- Results show items populated and time taken
-
Label/Progress Test:
- Set the number of updates (default: 5000)
- Click "Test Label/Progress Updates"
- Watch the progress bar and dynamic label updates
-
Window Creation Test:
- Set the number of windows to create (default: 50)
- Click "Test Window Creation/Destruction"
- Observe windows being created and destroyed
-
Widget Creation Test:
- Set the number of widget sets (default: 200)
- Click "Test Bulk Widget Creation"
- A new window opens showing created widgets
-
Memory Test:
- Set memory size in MB (default: 100)
- Click "Test Memory Usage"
- Results show allocation, write, and cleanup times
- Click "Run All Tests" to execute all benchmarks sequentially
- Use "Cancel Tests" to stop execution early
- Results are automatically saved if auto-save is enabled
- Tools → Compare Results to compare multiple test runs
- Shows performance differences and improvements
- Tracks performance trends over time
- Tools → Stress Test Mode for intensive testing
- Configurable iterations and load multipliers
- Generates comprehensive performance statistics
- Tools → Generate Report creates detailed HTML reports
- Includes charts, analysis, and recommendations
- Can be opened directly in web browser
- Save Results: File → Save Results (Cmd+S)
- Load Results: File → Load Results (Cmd+O)
- Export to CSV: File → Export to CSV
- Reset: File → Reset All Tests
- Theme Selection: Change TTK themes from the dropdown menu
- Auto-save: Toggle automatic result saving
- System Info: Show/hide system information panel
- Items/Updates per second: Rate of operations
- Creation/Destruction time: Window management speed
- Memory efficiency: Allocation and cleanup performance
- UI responsiveness: How well the interface remains interactive
- Operating system and version
- CPU cores and frequency
- Memory usage and availability
- Python and Tkinter versions
- Available TTK themes
{
"timestamp": "2025-05-25 10:30:45",
"system_info": {
"platform": "macOS-14.0-arm64",
"python_version": "3.11.0",
"cpu_count": 8,
"memory_total_gb": 16
},
"test_results": {
"treeview": {
"items": 1000,
"duration": 0.1234,
"rate": 8103.2
}
}
}Test,Metric,Value,Unit
treeview,items,1000,count
treeview,duration,0.1234,seconds
treeview,rate,8103.2,count
- Cmd+S (Mac) / Ctrl+S (Windows/Linux): Save results
- Cmd+O (Mac) / Ctrl+O (Windows/Linux): Load results
- Cmd+Q (Mac) / Ctrl+Q (Windows/Linux): Quit application
Access Tools → Performance Monitor to view:
- Real-time CPU usage
- Memory consumption graphs
- System resource utilization
View detailed system specs via Tools → System Information:
- Hardware configuration
- Software versions
- Available themes
- Performance capabilities
- Run multiple test configurations
- Compare results across different settings
- Export data for external analysis
-
"psutil not found" error:
pip install psutil
-
Theme switching fails:
- Some themes may not be available on your system
- Try different themes from the dropdown
-
Performance seems slow:
- Reduce test parameters for faster execution
- Close other applications to free system resources
- Check system info for resource availability
-
Tests won't run:
- Ensure Python 3.8+ is installed
- Verify Tkinter is available
- Check console for error messages
- macOS: Uses 'aqua' theme by default
- Windows: May use 'vista' or 'win32' themes
- Linux: Typically uses 'clam' or 'alt' themes
- Close unnecessary applications
- Run tests multiple times and average results
- Use consistent test parameters
- Monitor system resources during testing
- Use the results to identify performance bottlenecks
- Test on target deployment platforms
- Compare different widget configurations
- Optimize based on real-world usage patterns
Contributions are welcome! Areas for improvement:
- Additional benchmark tests
- Better visualization of results
- Cross-platform compatibility enhancements
- Performance optimization suggestions
- Fork the repository
- Create a feature branch
- Make changes with tests
- Submit a pull request
- Added theme switching
- System monitoring capabilities
- Result saving/loading
- Performance summary
- Threading support
- Memory testing
- Enhanced UI
- Basic benchmark tests
- Simple UI
- Core functionality
This project is licensed under the MIT License - see the LICENSE file for details.
- tkinter: GUI framework (built-in with Python)
- psutil: System and process monitoring
- threading: Non-blocking test execution
- json: Result data persistence
- csv: Data export functionality
- Object-oriented design
- Event-driven GUI
- Threaded test execution
- Modular test functions
- Extensible result storage
- Tests designed to minimize interference
- Periodic UI updates for responsiveness
- Memory-efficient data structures
- Optimized widget creation patterns
For issues, questions, or contributions:
- Check the troubleshooting section
- Review existing issues
- Create a new issue with detailed information
- Include system information and error messages
Happy Benchmarking! 🚀
Use this tool to optimize your Tkinter applications and ensure they perform well across different systems and configurations.
