Skip to content

Add cute pastel-themed Tkinter calculator#1

Open
amna-2 wants to merge 1 commit intomainfrom
codex/build-simple-calculator-with-colored-ui
Open

Add cute pastel-themed Tkinter calculator#1
amna-2 wants to merge 1 commit intomainfrom
codex/build-simple-calculator-with-colored-ui

Conversation

@amna-2
Copy link
Copy Markdown
Owner

@amna-2 amna-2 commented Mar 2, 2026

Motivation

  • Provide a small, user-friendly desktop calculator implemented in Python with a playful pastel UI.
  • Ship a self-contained example that demonstrates basic arithmetic, decimals, and parentheses support with simple input controls.

Description

  • Add calculator.py which defines CuteCalculator, a Tkinter app with a styled display, color-coded buttons, and a floating ) button for parentheses.
  • Implement button handling for digits, operators, C (clear), (backspace), and = (evaluate) and wire the app to run with python calculator.py.
  • Add a lightweight expression sanitizer that allows only characters in 0123456789+-*/%.() and evaluate expressions with eval while disabling __builtins__ for basic safety.
  • Update README.md with run instructions and a short feature list for the new calculator.

Testing

  • Ran python -m py_compile calculator.py which succeeded, confirming the file is syntactically valid.
  • No automated GUI tests were run; the change contains only the application and docs updates (manual UI verification is expected when launching python calculator.py).

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3c40424c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread calculator.py
Comment on lines +16 to +18
display = tk.Entry(
root,
textvariable=self.display_var,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make display read-only or sync typed text before evaluation

The Entry is editable, but = evaluates self.expression (built only via button clicks), so any text the user types or pastes into the display is ignored and can leave the shown expression out of sync with what gets computed. In practice, typing 2+2 and pressing = does nothing (or evaluates an older button-built expression), which is a user-visible correctness bug for interactive input.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant