Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better version #14

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions calculator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from tkinter import *
from tkinter import ttk
from random import randrange
dialogue = ["Ask someone else", "I don't know", "Let me sleep on it", "Somewhere between 0-100","I know it but I won't tell you"]

class IntButton:
def __init__(self, calculator, name):
Expand Down Expand Up @@ -37,7 +39,7 @@ def __init__(self, root):
self.stored_op = None

# Create a new window
self.window = ttk.Frame(root, padding = 10)
self.window = ttk.Frame(root, padding = 100)
# Use the grid geometry manager
self.window.grid()
# Attach the display to the top of the grid
Expand All @@ -51,7 +53,7 @@ def __init__(self, root):
"8", "9", "+", "-",
"*", "/", "%", "=" ]):
button = self.makeButton(button_name)
button.button.grid(column = index % COLUMNS, row = index // COLUMNS + 1)
button.button.grid(column = index % COLUMNS, row = index // COLUMNS + 5)
print("Compsoc calculator")

# Show the display register
Expand All @@ -61,7 +63,7 @@ def redo_display(self):

# Show the accumulator
def display_acc(self):
self.display["text"] = str(self.acc)
self.display["text"] = dialogue[randrange(5)]

# Handle number button press
def handle_digit(self, digit):
Expand Down