python 2.7 - Making a Tkinter calculator that gives back percent at a given point in a interval -


hi i'm getting 'float' object not callable error while running code. i'm using python 2.7.

from __future__ import division import sys import math sys.argv=["main"] import tkinter tkinter import *   def calcrpmratio():     rpmmax = rpmmaxset.get     rpmmin = rpmminset.get     rpmpoint = rpmpointset.get     newrpmmax = rpmmax() - rpmmin()     result = rpmpoint() / newrpmmax()     showresult = label (mgui, text=str(resultcount)+". "+str(result)).pack()     global resultcount     resultcount +=1      return  resultcount = 1 mgui = tk() mgui.geometry('400x150+200+200') mgui.title('rpm percent calc') rpmmaxset = doublevar() rpmminset = doublevar() rpmpointset = doublevar() rpmmaxsetlabel = label(mgui, text='max rpm').pack() rpmmaxsetentry = entry(textvariable=rpmmaxset) .pack() rpmminsetlabel = label(mgui, text='min rpm').pack() rpmminsetentry = entry(textvariable=rpmminset) .pack() rpmminpointlabel = label(mgui, text='point rpm').pack() rpmpointsetentry = entry(textvariable=rpmpointset) .pack()  mbutton = button(mgui, text='calculate', command = calcrpmratio, fg = 'white', bg='black').pack() mgui.mainloop() 

i'm new python there might obvious answer this.

update follwing lines

rpmmax = rpmmaxset.get() rpmmin = rpmminset.get() rpmpoint = rpmpointset.get() newrpmmax = rpmmax- rpmmin result = rpmpoint / newrpmmax 

here edited version tried , works

from __future__ import division import sys import math sys.argv=["main"] import tkinter tkinter import *   def calcrpmratio():     rpmmax = rpmmaxset.get()     rpmmin = rpmminset.get()     rpmpoint = rpmpointset.get()     newrpmmax = rpmmax- rpmmin     result = rpmpoint / newrpmmax     showresult = label (mgui, text=str(resultcount)+". "+str(result)).pack()     global resultcount     resultcount +=1      return  resultcount = 1 mgui = tk() mgui.geometry('400x150+200+200') mgui.title('rpm percent calc') rpmmaxset = doublevar() rpmminset = doublevar() rpmpointset = doublevar() rpmmaxsetlabel = label(mgui, text='max rpm').pack() rpmmaxsetentry = entry(textvariable=rpmmaxset) .pack() rpmminsetlabel = label(mgui, text='min rpm').pack() rpmminsetentry = entry(textvariable=rpmminset) .pack() rpmminpointlabel = label(mgui, text='point rpm').pack() rpmpointsetentry = entry(textvariable=rpmpointset) .pack()  mbutton = button(mgui, text='calculate', command = calcrpmratio, fg = 'white', bg='black').pack() mgui.mainloop() 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -