8 Replies - 4055 Views - Last Post: 18 June 2012 - 01:45 AM

#1 atik97   User is offline

  • ???
  • member icon

Reputation: 144
  • View blog
  • Posts: 715
  • Joined: 16-September 08

Simple GUI calculator

Posted 04 March 2009 - 02:59 PM

Description: You need to install easygui.A calculator written in easygui and performs basic arithmetic manipulations.
import sys
from easygui import *
msg="Welcome to Simple Calculator!";
title="Simple Calculator"
choices=["Enter","About","Exit"]
choice=indexbox(msg,title,choices)

def input_numbers():    #a function to take input
    global a,b
    a=float(enterbox("First Number"))
    b=float(enterbox("Second Number"))

def manipulations():    #defines a function to perform arithmetic manipulations
    title="Simple Calculator"
    msg="Select Action"
    choices=["Addition","Subtraction","Multiplication","Division","Exit"]
    select=indexbox(msg,title,choices)
    if select==0:
        input_numbers()
        result=a+b
        msgbox("The Result is %s"%result)
    elif select==1:
        input_numbers()
        result=a-b
        msgbox("The Result is %s"%result)
    elif select==2:
        input_numbers()
        result=a*b
        msgbox("The Result is %s"%result)
    elif select==3:
        input_numbers()
        result=a/b
        msgbox("The Result is %s"%result)
    else:
        sys.exit(0)

def loop():
    manipulations()
    title="Confirmation"
    msg="Really Exit?"
    if ynbox(msg,title):
        sys.exit(0)
    else:
        pass
        manipulations()

if choice==0:
    while True:
        loop()
elif choice==1:
    msgbox("Simple CalculatornVersion:1.0nCreated by-atik2009nMail Me:[email protected]","About")
    sys.exit(0)

else:
    sys.exit(0)



Is This A Good Question/Topic? 0
  • +

Replies To: Simple GUI calculator

#2 tivrfoa   User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 98
  • Joined: 25-January 09

Re: Simple GUI calculator

Posted 07 March 2009 - 07:34 AM

i don't know python. Isn't there switch case in python? many elif!
Was This Post Helpful? 0
  • +
  • -

#3 atik97   User is offline

  • ???
  • member icon

Reputation: 144
  • View blog
  • Posts: 715
  • Joined: 16-September 08

Re: Simple GUI calculator

Posted 07 March 2009 - 08:14 AM

No. It doesn't have.
Was This Post Helpful? 0
  • +
  • -

#4 programble   User is offline

  • (cons :dic :head)

Reputation: 50
  • View blog
  • Posts: 1,315
  • Joined: 21-February 09

Re: Simple GUI calculator

Posted 14 October 2009 - 03:14 PM

What is easygui? My Python interpreter never heard of it.
Was This Post Helpful? 0
  • +
  • -

#5 atik97   User is offline

  • ???
  • member icon

Reputation: 144
  • View blog
  • Posts: 715
  • Joined: 16-September 08

Re: Simple GUI calculator

Posted 15 October 2009 - 12:25 AM

easygui is a python module which is used to give your program a graphical interface. By default it is not present with interpreter, you need to install it first.
Was This Post Helpful? 0
  • +
  • -

#6 shy28   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 15-February 11

Re: Simple GUI calculator

Posted 15 February 2011 - 05:14 PM

Do you have a calculator that looks like a calculator??please i need help...
Was This Post Helpful? 0
  • +
  • -

#7 shy28   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 15-February 11

Re: Simple GUI calculator

Posted 15 February 2011 - 05:15 PM

the interface is look like a real calcu and function the same as the calcu does...pls..
Was This Post Helpful? 0
  • +
  • -

#8 deviljeon   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 8
  • Joined: 29-January 12

Re: Simple GUI calculator

Posted 30 January 2012 - 01:17 AM

I have a link to read... Im not expert in Python so... but here.. http://www.ferg.org/...i/tutorial.html hope it helps you :)
Was This Post Helpful? 0
  • +
  • -

#9 appleMOND   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 18-June 12

Re: Simple GUI calculator

Posted 18 June 2012 - 01:45 AM

Traceback (most recent call last): File "D:/AITV5-STAFF FILES/mond/New Folder/New Folder/New Folder/New Folder1/Calculator", line 2, in from easygui import * ImportError: No module named easygui That is an error that I got when I start to run it.. where is "from easygui import *" ? looking forward for some answers
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1