Skip to content

Vic-Godwin/VicAdvancedCalculator

Repository files navigation

๐Ÿ“Ÿ Vic Advanced Calculator v1.2

image

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.


โœจ Key Features (v1.2)

  • โœ… Standard Arithmetic Operations: +, -, *, /, =, sqrt, Back
  • ๐Ÿง  AI Assistant via ChatGPT (GPT-4o): Solves complex math using OpenAI
  • ๐Ÿ” Ans Variable: Recall the last result using Ans in 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 .ico file through resource_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

๐Ÿ†• Whatโ€™s New in v1.2

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

๐Ÿ“ฆ Project Structure

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)
โ”‚
โ””โ”€โ”€

๐Ÿ›  Requirements

  • 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

๐Ÿงช Installation & Running

โ–ถ๏ธ Run Normally

python vic_calculator_v1.2.py

๐Ÿ› ๏ธ Build EXE (Windows)

pyinstaller --onefile --windowed --icon=vcal.ico vic_calculator_v1.2.py

โœ… App icon and assets will load automatically using the resource_path() helper.

๐Ÿ’ก Example Usage

โž• Basic Operations

Click:

7 โ†’ + โ†’ 3 โ†’ =
Output: 10

๐Ÿ” Using Previous Result (Ans)

Evaluate an expression like:

6 * 4 = 24
Now press:


+ โ†’ 3 โ†’ =
It becomes: Ans + 3 โ†’ 24 + 3 โ†’ 27

โˆš Square Root

Press:

sqrt Calculates the square root of the last result or current input.

โฑ Check Time Click Check Time to toggle display of system time.

๐Ÿค– Ask AI

Type: Solve: integral of x^2

Click Ask AI

Wait for a GPT-4o-generated answer.

๐Ÿ” Safety & Design

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

๐Ÿ”ฎ Future Plans (v1.3+)

๐Ÿ“Š 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

๐Ÿ‘จโ€๐Ÿ’ป Author

Victor Godwin ๐Ÿ“ง Email: Victor Godwin

๐Ÿ“„ License MIT License. Feel free to fork, use, and contribute โ€” just credit the author where appropriate.

๐Ÿง  Tip for Developers

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.

About

๐Ÿ”ข VicAdvanced Calculator A sleek, AI-powered desktop calculator for Windows built with Python and Tkinter. Perform basic and scientific calculations, access a built-in math assistant (ChatGPT), and enjoy real-time features like Ans memory and time display. ๐Ÿš€ coming soon: graph functions, ๐Ÿ•˜ Smart History (recall past calculations anytime)...

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages