Skip to content
Open
10 changes: 0 additions & 10 deletions Problem Statement 1/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions Problem Statement 2/README.md

This file was deleted.

109 changes: 109 additions & 0 deletions Problem Statement 3/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#github.com/atombalan

#importing necessary modules
import tkinter as tk
import math
from tkinter import *

#Tkinter window setting with dimentions as 600*700
window = Tk()
window.geometry("650x700")
window.title("PyCalc")
icon = PhotoImage(file = "./calculator.png")
window.iconphoto(True, icon)
tk.Label(window, text="Python GUI Calculator with History", font=('Sans 18'), pady = 10).pack()
tk.Label(window, text="github.com/atombalan", font=('Sans 10'), pady = 5).pack()


#setting scrollbar for smooth UI
scrollbar = Scrollbar(window)
scrollbar.pack(side = RIGHT, fill = Y)
expression = ""
history = Text(window, wrap = None, yscrollcommand = scrollbar.set)
scrollbar.config(command=history.yview)

#USER INPUT FUNCTION
def butttonClicked(item):
global expression
expression = expression + str(item)
inputText.set(expression)

def butttonClearEntry():
global expression
expression = expression[:-1]
inputText.set(expression)

#EVALUVATION OF EXPRESSION and STORING
def butttonEqual():
global expression
try:
result = str(eval(expression))
inputText.set(result)
hist = str(expression) + " = " + result + "\n"
history.insert(END, hist)
except:
result = "Error!"
inputText.set(result)
hist = str(expression) + " = " + result + "\n"
history.insert(END, hist)
expression = ""

#INPUT EXPRESSION
inputText = StringVar()
inputFrame = Frame(window, width = 312, height = 50, bd = 0, highlightbackground = "white", highlightcolor = "black", highlightthickness = 1)
inputFrame.pack(side = TOP)
inputField = Entry(inputFrame, font = ('Roboto', 18, 'bold'), textvariable = inputText, width = 50, bg = "#fff", bd = 0, justify = RIGHT)
inputField.grid(row = 0, column = 0)
inputField.pack(ipady = 10, pady = 3)

#BUTTONS
# frame for buttons
buttonsFrame = Frame(window, width = 312, height = 272.5, bg = "white")
buttonsFrame.pack()
piValue = Button(buttonsFrame, text = "π", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("math.pi")).grid(row = 0, column = 0, padx = 3, pady = 3)
factorial = Button(buttonsFrame, text = "x!", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("math.factorial(")).grid(row = 0, column = 1, padx = 3, pady = 3)
bracket1 = Button(buttonsFrame, text = "(", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("(")).grid(row = 0, column = 2, padx = 3, pady = 3)
bracket2 = Button(buttonsFrame, text = ")", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked(")")).grid(row = 0, column = 3, padx = 3, pady = 3)
modulo = Button(buttonsFrame, text = "%", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("%")).grid(row = 0, column = 4, padx = 3, pady = 3)
clearEntry = Button(buttonsFrame, text = "CE", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClearEntry()).grid(row = 0, column = 5, padx = 3, pady = 3)

eValue = Button(buttonsFrame, text = "e", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("math.e")).grid(row = 1, column = 0, padx = 3, pady = 3)
log = Button(buttonsFrame, text = "ln", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("math.log(")).grid(row = 1, column = 1, padx = 3, pady = 3)
seven = Button(buttonsFrame, text = "7", fg = "black", width = 10, height = 3, bd = 0, bg = "#f1f3f4", cursor = "hand2", command = lambda: butttonClicked(7)).grid(row = 1, column = 2, padx = 3, pady = 3)
eight = Button(buttonsFrame, text = "8", fg = "black", width = 10, height = 3, bd = 0, bg = "#f1f3f4", cursor = "hand2", command = lambda: butttonClicked(8)).grid(row = 1, column = 3, padx = 3, pady = 3)
nine = Button(buttonsFrame, text = "9", fg = "black", width = 10, height = 3, bd = 0, bg = "#f1f3f4", cursor = "hand2", command = lambda: butttonClicked(9)).grid(row = 1, column = 4, padx = 3, pady = 3)
divide = Button(buttonsFrame, text = "/", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("/")).grid(row = 1, column = 5, padx = 3, pady = 3)

sine = Button(buttonsFrame, text = "sin", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("math.sin(")).grid(row = 2, column = 0, padx = 3, pady = 3)
log10 = Button(buttonsFrame, text = "log", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("math.log10(")).grid(row = 2, column = 1, padx = 3, pady = 3)
four = Button(buttonsFrame, text = "4", fg = "black", width = 10, height = 3, bd = 0, bg = "#f1f3f4", cursor = "hand2", command = lambda: butttonClicked(4)).grid(row = 2, column = 2, padx = 3, pady = 3)
five = Button(buttonsFrame, text = "5", fg = "black", width = 10, height = 3, bd = 0, bg = "#f1f3f4", cursor = "hand2", command = lambda: butttonClicked(5)).grid(row = 2, column = 3, padx = 3, pady = 3)
six = Button(buttonsFrame, text = "6", fg = "black", width = 10, height = 3, bd = 0, bg = "#f1f3f4", cursor = "hand2", command = lambda: butttonClicked(6)).grid(row = 2, column = 4, padx = 3, pady = 3)
multiply = Button(buttonsFrame, text = "*", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("*")).grid(row = 2, column = 5, padx = 3, pady = 3)

cosine = Button(buttonsFrame, text = "cos", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("math.cos(")).grid(row = 3, column = 0, padx = 3, pady = 3)
squareroot = Button(buttonsFrame, text = "√", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("math.sqrt(")).grid(row = 3, column = 1, padx = 3, pady = 3)
one = Button(buttonsFrame, text = "1", fg = "black", width = 10, height = 3, bd = 0, bg = "#f1f3f4", cursor = "hand2", command = lambda: butttonClicked(1)).grid(row = 3, column = 2, padx = 3, pady = 3)
two = Button(buttonsFrame, text = "2", fg = "black", width = 10, height = 3, bd = 0, bg = "#f1f3f4", cursor = "hand2", command = lambda: butttonClicked(2)).grid(row = 3, column = 3, padx = 3, pady = 3)
three = Button(buttonsFrame, text = "3", fg = "black", width = 10, height = 3, bd = 0, bg = "#f1f3f4", cursor = "hand2", command = lambda: butttonClicked(3)).grid(row = 3, column = 4, padx = 3, pady = 3)
minus = Button(buttonsFrame, text = "-", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("-")).grid(row = 3, column = 5, padx = 3, pady = 3)

tangent = Button(buttonsFrame, text = "tan", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("math.tan(")).grid(row = 4, column = 0, padx = 3, pady = 3)
xPowery = Button(buttonsFrame, text = u"exp", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("**")).grid(row = 4, column = 1, padx = 3, pady = 3)
zero = Button(buttonsFrame, text = "0", fg = "black", width = 10, height = 3, bd = 0, bg = "#f1f3f4", cursor = "hand2", command = lambda: butttonClicked(0)).grid(row = 4, column = 2, padx = 3, pady = 3)
point = Button(buttonsFrame, text = ".", fg = "black", width = 10, height = 3, bd = 0, bg = "#f1f3f4", cursor = "hand2", command = lambda: butttonClicked(".")).grid(row = 4, column = 3, padx = 3, pady = 3)
equals = Button(buttonsFrame, text = "=", fg = "white", width = 10, height = 3, bd = 0, bg = "#4285f4", cursor = "hand2", command = lambda: butttonEqual()).grid(row = 4, column = 4, padx = 3, pady = 3)
plus = Button(buttonsFrame, text = "+", fg = "black", width = 10, height = 3, bd = 0, bg = "#dadce0", cursor = "hand2", command = lambda: butttonClicked("+")).grid(row = 4, column = 5, padx = 3, pady = 3)


tk.Label(window, text="History:", font=('Sans'), pady = 10).pack()

#HISTORY DISPLAY
history.pack()

#APP RUN LOOP
window.mainloop()



#github.com/atombalan
Binary file added Problem Statement 3/calculator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 3 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,8 @@
# GAME OF CODES
## PyCalc

PyCalc is a Calculator with GUI made with tkinter and math libraries in python. Update python and run the app


# How to Register in GAME OF CODES
![demo image](https://user-images.githubusercontent.com/78723235/176746617-1eed640c-7c43-4311-90d7-423f97a7c929.png)

#### Step1: Register yourself in our website

[Hack2skill Website](https://hack2skill.com/hack/goc3)

#### Step2: Join our discord server

[Hack2skill Discord Server](https://discord.gg/2acmdTsKeR)

#### Step3: Follow our github organization

[Hack2skill GitHub Organization](https://github.com/hack2skill)

#### Step4: Read the guidelines
***

## Guidelines for the participants:

1. Participant should register for the competition in our website.
2. Should join our discord server.
3. Participants can participate individually only.
4. Please refrain from discussing strategy during the contest.
5. Do not share your code during the contest.
6. Plagiarism of any means will lead to disqualification.
7. All submissions will run through a plagiarism detector before deciding the winners.Any case of code plagiarism will disqualify both users from the contest & their scores would be set to null for the particular contest.
8. The decisions of the panel will be final and binding in all forms.

#### Step5: Read the Score Criteria :


### Important Note:

Primary Shortlisting would be based on the video, hence try to make the video of good quality.

## Score Criteria:

Scores are given out of 100 based on :

Creativity of the Project (10 points) <br />
Unique Selling Point (10 points) <br />
Solving the Problem Statement (10 points) <br />
Presentation Skills - eg. Video (10 points) <br />
Applying GUI - eg. Browser using Django/Flask or Tkinter (10 points ) <br />


***


#### Step6: Be active in our discord server

# Project Submission:
#### Step7: Compete with others by making a PR in our repository

Participants have to make a video (screen recording) of the workings of their project.

They need to upload the project code to the Github. <br />
Step 7.1: Fork the main repository <br/>
Step 7.2: Delete the problem statement folders you are not working on <br/>
Step 7.3: Upload the video of its working in the main folder and files in the problem statement folder <br/>
Step 7.4: Send pull request to the repository <br/>
***
Binary file added demo image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added videoexplanation.mp4
Binary file not shown.