Vic Advanced Calculator is a modern and intelligent desktop calculator built with Python and Tkinter, supporting both standard and scientific calculations, AI-assisted problem-solving (via OpenAI GPT-4o), and power-state simulation. The latest version (v1.2) adds icon support for PyInstaller builds, implements a persistent power control system, and introduces the Ans variable to reuse previous results in real-time calculations.
- โ
Standard Arithmetic Operations:
+,-,*,/,=,sqrt,Back - ๐ง AI Assistant via ChatGPT (GPT-4o): Solves complex math using OpenAI
- ๐ Ans Variable: Recall the last result using
Ansin subsequent expressions - ๐น๏ธ ON/OFF Simulation: Disables calculator logic and GUI on power OFF
- ๐ Check Time Button: Displays current system time in AM/PM format
- ๐จ Custom App Icon: Supports
.icofile throughresource_path()for PyInstaller - ๐ฆ EXE-Ready Architecture: Uses
resource_path()for asset bundling - ๐ฅ๏ธ Zoomed Startup: Launches in fullscreen using
root.state("zoomed") - ๐ก๏ธ Safe Error Handling: Protects users from invalid expressions or empty operations
- ๐ Read-Only AI Output: Lock AI result field to prevent editing
- ๐ค Backspace Button: Removes last input character
- ๐ป Pythonic Parsing with AST: Ensures secure evaluation of expressions
| Feature | Description |
|---|---|
ON/OFF Power |
Now functional; disables all input when OFF, and re-enables when ON |
Ans Support |
Typing an operator after evaluation uses Ans as previous result |
resource_path() |
Lets you bundle assets (like .ico) correctly for .exe using PyInstaller |
vcal.ico Support |
Calculator now loads a custom icon in both script and compiled form |
| GUI Improvements | Improved reliability, startup behavior, and reduced clutter |
display_label1 |
Displays the output/result; reset on ON/OFF |
VicAdvancedCalculator/
โ
โโโ VicAdvancedCalculator_v1.0.py # Initial version
โโโ VicAdvancedCalculator_v1.1.py # Chained result, better layout
โโโ VicAdvancedCalculator_v1.2.py # Adds ON/OFF, Ans, .ico, PyInstaller support
โโโ VicAdvancedCalculator_v1.3.py # (Future/working version)
โ
โโโ vcal.ico # App icon used in v1.2+
โโโ README.md # Project documentation (markdown)
โโโ requirements.txt # Python dependencies (openai, etc.)
โโโ LICENSE # MIT License (or LICENSE.txt if thatโs your style)
โ
โโโ
- Python 3.8 or later
- OpenAI account & API key
- Internet connection (for AI assistant)
- Required libraries:
pip install openai
Optional for .exe creation: pip install pyinstaller
python vic_calculator_v1.2.py
pyinstaller --onefile --windowed --icon=vcal.ico vic_calculator_v1.2.py
Click:
7 โ + โ 3 โ =
Output: 10
6 * 4 = 24
Now press:
+ โ 3 โ =
It becomes: Ans + 3 โ 24 + 3 โ 27
Press:
sqrt Calculates the square root of the last result or current input.
โฑ Check Time Click Check Time to toggle display of system time.
Type: Solve: integral of x^2
Click Ask AI
Wait for a GPT-4o-generated answer.
Input is filtered through ast.parse() to avoid unsafe eval()
AI Output is locked with tk.DISABLED to prevent accidental edits
try/except blocks wrap all core logic for safe error messaging
Icons and assets resolve using resource_path() for compatibility with PyInstaller
๐ Graph plotting (line, bar, equation-based)
๐ Calculation history (local or session-based)
๐ญ Scientific functions: sin, cos, tan, log, exp, etc.
๐งฉ Modular plugin support for new tools
๐ Dark mode & themes
Victor Godwin ๐ง Email: Victor Godwin
๐ License MIT License. Feel free to fork, use, and contribute โ just credit the author where appropriate.
When building with PyInstaller and using an icon:
.iconbitmap(resource_path("vcal.ico"))
This ensures the icon loads whether you're running the script or an .exe.
