Python Forum
Converting Entry field value to integer in tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting Entry field value to integer in tkinter
#1
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())

Attached Files

Thumbnail(s)
   
Reply
#2
Please post code in bbcode tags, please do not use images see: bbcode
Reply
#3
My question was answered. Instead of converting entry field to int, I converted it to float since the value had a decimal.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] tkinter.TclError: expected integer but got " " TWB 2 3,526 Feb-19-2023, 05:11 PM
Last Post: TWB
  [Tkinter] Making entry global in tkinter with multiprocessing luckyingermany 2 2,284 Jan-21-2022, 03:46 PM
Last Post: deanhystad
  Tkinter Exit Code based on Entry Widget Nu2Python 6 2,874 Oct-21-2021, 03:01 PM
Last Post: Nu2Python
  [Tkinter] Update variable using tkinter entry methon drSlump 6 5,093 Oct-15-2021, 08:01 AM
Last Post: drSlump
  Tkinter | entry output. Sap2ch 1 1,949 Sep-25-2021, 12:38 AM
Last Post: Yoriz
  .get() from generated Entry widgets in tkinter snakes 4 4,155 May-03-2021, 11:26 PM
Last Post: snakes
  Entry Validation in tkinter shahulvk 4 16,029 Oct-28-2020, 10:12 PM
Last Post: joe_momma
  [Tkinter] Getting Input from Tkinter Entry juliabrushett 6 21,218 May-30-2020, 03:29 PM
Last Post: Larz60+
  Disable entry field and still see value scratchmyhead 5 4,969 May-11-2020, 08:09 PM
Last Post: menator01
  [Tkinter] Tkinter adding entry values scratchmyhead 1 2,164 May-04-2020, 05:21 AM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020