Skip to content Skip to sidebar Skip to footer

Valueerror: Invalid Literal For Int() With Base 10: ' ',on Tkinter Entry And Postgresql Database

I tried to operate on tkinter entry ... The value of that entry is used as integer type in the database.. I converted my entry value to integer as follows... self.yr=(int(self.yea

Solution 1:

Consider these three lines of code:

self.isbn=Entry(window)
self.isbn.grid(row=1,column=3)
self.isb=(int(self.isbn.get()))

You are creating a Entry widget, and about a microsecond later you are getting the value and converting it to an int. The user will not have even seen the entry widget, much less typed into it. Thus, the value will be the empty string, and the call to int() will fail.

Your code must wait to call get() until after the user has had a chance to enter data.

Post a Comment for "Valueerror: Invalid Literal For Int() With Base 10: ' ',on Tkinter Entry And Postgresql Database"