Overview
Contributions to AI Math Notes are welcome! This project is open source under the MIT License and accepts improvements, bug fixes, and feature additions.Getting Started
Prerequisites
- Python 3.x
- OpenAI API key
- Basic understanding of Tkinter and PIL
Setup Development Environment
- Clone the repository
- Install dependencies:
- Set up your OpenAI API key as an environment variable:
- Run the application:
Project Structure
The project follows a simple structure:main.py:8-143 within the DrawingApp class.
Future Improvements
From the README, the following improvements are planned:Auto-detect Equals Sign
Current Limitation: The equals sign must be the last thing drawn before clicking Calculate. The answer is positioned based on the coordinates of the last drawing action (main.py:124-128).
- Detect equals signs anywhere on the canvas
- Identify which equations are unanswered (no value on the right side)
- Position answers correctly regardless of drawing order
- Use OCR/symbol detection on the PIL Image
- Train a custom model to recognize mathematical symbols
- Integrate OpenCV for contour detection and symbol classification
- Modify
draw_answer()to accept detected equals sign coordinates
Other Contribution Ideas
- Error Handling: Add try-except blocks around API calls (
main.py:95-110) - Loading Indicators: Show visual feedback during API processing
- Multiple Equations: Support solving multiple equations in one session
- Export Functionality: Save canvas as image file
- Configuration: Make canvas size, colors, and fonts customizable
- Response Validation: Verify API responses are valid numbers
- Offline Mode: Cache common calculations
- Handwriting Recognition: Improve accuracy with preprocessing
Contribution Guidelines
Code Style
- Follow PEP 8 Python style guidelines
- Maintain the existing class structure
- Add comments for complex logic
- Keep methods focused and single-purpose
Testing Your Changes
Before submitting:- Test basic drawing functionality
- Verify undo/clear operations work correctly
- Test calculation with various equations:
- Simple arithmetic:
5 + 3 = - Multiple operations:
10 * 2 + 5 = - Edge cases:
0 / 0 =
- Simple arithmetic:
- Ensure both keyboard shortcuts work (Cmd/Ctrl+Z, Enter/Return)
Submitting Changes
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request with:
- Clear description of changes
- Why the change is needed
- Any testing performed
Key Areas for Contribution
1. Drawing Engine (main.py:45-60)
Improve the drawing system:
- Add brush size controls
- Support different colors
- Implement eraser functionality
- Add shape drawing tools
2. API Integration (main.py:87-113)
Enhance GPT-4o integration:
- Add error handling and retries
- Implement response validation
- Support alternative models
- Add rate limiting
3. User Interface
Expand the UI capabilities:- Add menu bar with File/Edit/Help
- Create settings dialog
- Improve button layout
- Add status bar for feedback
4. Action Management (main.py:68-85)
Improve undo/redo:
- Implement redo functionality
- Add action history limit
- Support selective undo (undo specific strokes)