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 Exit Code based on Entry Widget Nu2Python 6 369 Oct-21-2021, 03:01 PM
Last Post: Nu2Python
  [Tkinter] Update variable using tkinter entry methon drSlump 6 635 Oct-15-2021, 08:01 AM
Last Post: drSlump
  Tkinter | entry output. Sap2ch 1 318 Sep-25-2021, 12:38 AM
Last Post: Yoriz
  .get() from generated Entry widgets in tkinter snakes 4 1,105 May-03-2021, 11:26 PM
Last Post: snakes
  Entry Validation in tkinter shahulvk 4 3,082 Oct-28-2020, 10:12 PM
Last Post: joe_momma
  [Tkinter] Getting Input from Tkinter Entry juliabrushett 6 15,634 May-30-2020, 03:29 PM
Last Post: Larz60+
  Disable entry field and still see value scratchmyhead 5 1,367 May-11-2020, 08:09 PM
Last Post: menator01
  [Tkinter] Tkinter adding entry values scratchmyhead 1 974 May-04-2020, 05:21 AM
Last Post: Yoriz
  [Tkinter] Entry box not showing 2 decimal places Chuck_Norwich 3 2,291 Apr-24-2020, 05:28 PM
Last Post: deanhystad
  [Tkinter] Unable to get current contents of the entry field where the content is the file path pmpinaki 1 1,099 Apr-18-2020, 06:45 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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