1

I need help with changing "textvariable" to a int var. Here is my code:

from Tkinter import *

root = Tk()

strfname = IntVar()

strlname = IntVar()

labelf = Label(root, text = 'number').pack()
fname = Entry(root, justify='left', textvariable = strfname).pack() 

labell = Label(root, text = 'number 2').pack()
lname = Entry(root, justify='left', textvariable = strlname).pack()

root.mainloop()

Thanks!

1
  • Since you used IntVar, it's already an integer. No conversion needed. Commented Aug 1, 2017 at 17:02

1 Answer 1

2

use .get

number_variable = strfname.get()
Sign up to request clarification or add additional context in comments.

1 Comment

It's already an IntVar, that conversion is useless. Just use get().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.