## Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

PLUS

# Extracting numeric values from tkinter entry boxes in Python

I am tasked with making a simple calculator to take a purchase amount and calculate total amount paid (with interest) and monthly payments. I don't have that much experience with the GUI library tkinter, so I am struggling with how to make the entry boxes yield the float and int variables necessary to complete the task. I have looked at so many error messages and so many online examples of how to do it that I just can't interpret. I know there isn't a lot of tkinter stuff here but I am hoping someone can show me how to turn the entries into amount, rate and years...the code below is for an intermediate stage. I'll deal with interest form once I have the correcly parsed numbers.

thanks.

```from tkinter import *
from tkinter import messagebox

def multiply(var1, var2, var3):
product = var1 * var2 * var3
messagebox.showinfo(str(product))
return product

def btnClick(event):
x = float(entry.get())

main = Tk()
main.title("Assignment 16")

main.geometry("500x500")
main["bg"] = "#000066"

lblFirst = Label(main, text="Amount to Pay: ")

amount = " "
amount.set("default")
entry = Entry(main, width=20)
entry.grid(row=0, column=4)

lblSecond = Label(main, text="Interest Rate (like 7.5): ")

rate = " "
rate.set("default")
entry2 = Entry(textvariable=rate)
entry2.grid(row=2, column=4)

lblThird = Label(main, text="Years to Pay: ")

years = " "
years.set("default")
entry3 = Entry(textvariable=years)
entry3.grid(row=4, column=4)

num3 = int(years)

lblFourth = Label(main, text="Monthly Payment: ")