+0  
 
+3
1
795
4
avatar+2407 

Hello

 

This is about coding, not math. 

I want to create a simple app, a calculator. 

I "know" Python and a bit of html and javascript, however all of that is on repl.it. 

Any suggestions/tips on how to create an actual app?

I'm not sure what platform to use, or how to do anything really. 

I can create a "calculator" in python, but not sure how to make it look good/professional. 

Thank you. :)))

 

=^._.^=

 May 7, 2021
 #1
avatar+506 
+1

You could try PyGame or wxPython, and there are plenty of tutorials on YT; I experimented with both a few years ago and wxPython seems to be better for making a calculator, since it already has buttons, textboxes, and such things already defined.

Also, I never heard of repl.it; it looks pretty cool and I am going to check it out.

 May 7, 2021
 #2
avatar+2407 
+1

Thank you. :))

I've used pygame before to create things like tetris or snake, but I didn't think it would be right since buttons were hard to make. 

Repl.it is great for collaboration projects since you can share it with other people, however it is a lot slower than other IDEs. 

 

=^._.^=

catmg  May 8, 2021
 #3
avatar+876 
+1

Here is one I made a while ago...

 

from tkinter import *

 

def iCalc(source, side):

storeObj = Frame(source, borderwidth=4, bd=4, bg="powder blue")

storeObj.pack(side=side, expand =YES, fill =BOTH)

return storeObj

 

def button(source, side, text, command=None):

storeObj = Button(source, text=text, command=command)

storeObj.pack(side=side, expand = YES, fill=BOTH)

return storeObj

 

class app(Frame):

def __init__(self):

Frame.__init__(self)

self.option_add('*Font', 'arial 20 bold')

self.pack(expand = YES, fill =BOTH)

self.master.title('Calculator')

 

display = StringVar()

Entry(self, relief=RIDGE, textvariable=display,

justify='right'

, bd=30, bg="powder blue").pack(side=TOP,

expand=YES, fill=BOTH)

 

for clearButton in (["C"]):

erase = iCalc(self, TOP)

for ichar in clearButton:

button(erase, LEFT, ichar, lambda

storeObj=display, q=ichar: storeObj.set(''))

 

for numButton in ("789/", "456*", "123-", "0.+"):

FunctionNum = iCalc(self, TOP)

for iEquals in numButton:

button(FunctionNum, LEFT, iEquals, lambda

storeObj=display, q=iEquals: storeObj

.set(storeObj.get() + q))

 

EqualButton = iCalc(self, TOP)

for iEquals in "=":

if iEquals == '=':

btniEquals = button(EqualButton, LEFT, iEquals)

btniEquals.bind(' ', lambda e,s=self,

storeObj=display: s.calc(storeObj), '+')


 

else:

btniEquals = button(EqualButton, LEFT, iEquals,

lambda storeObj=display, s=' %s ' % iEquals: storeObj.set

(storeObj.get() + s))

 

def calc(self, display):

try:

display.set(eval(display.get()))

except:

display.set("ERROR")


 

if __name__=='__main__':

app().mainloop()

 

laugh

 May 13, 2021
 #4
avatar+2407 
0

Thank you. 

I tried it, and it looks amazing. :))

 

=^._.^=

catmg  May 14, 2021

1 Online Users