Python Forum
Converting Entry field value to integer in tkinter - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: Converting Entry field value to integer in tkinter (/thread-26720.html)



Converting Entry field value to integer in tkinter - scratchmyhead - May-11-2020

When I try to convert an entry field value to an integer, I get an error like: 'Invalid literal for int'. How can I convert an entry filed to an integer without getting this error? Below is part of my code. Where I want the variable 'ratep' to equal the integer of the entry field 'ratee'.

ratep = int(ratee.get())



RE: Converting Entry field value to integer in tkinter - Larz60+ - May-11-2020

Please post code in bbcode tags, please do not use images see: bbcode


RE: Converting Entry field value to integer in tkinter - scratchmyhead - May-11-2020

My question was answered. Instead of converting entry field to int, I converted it to float since the value had a decimal.