title: ValueError: invalid literal for int() with base 10: ' ',on tkinter entry and Postgresql database
body: <p>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...</p>
  
  <blockquote>
    <p>self.yr=(int(self.year.get()))</p>
    
    <p>self.isb=(int(self.isbn.get()))</p>
  </blockquote>
  
  <p>eventhough it throws ValueError..</p>
  
  <p>How to convert string value from an ENTRY WIDGET to an integer value to be used as an argument for my search function in Postgresql database..</p>
  
  <p>My Backend search function is: here in the code..[year,isbn are integer values]</p>
  
  <pre><code>def search(self,title=None,author=None,year=None,isbn=None):
          self.cur.execute("SELECT * FROM books WHERE title=%s or author=%s or year=%s or isbn=%s",(title,author,year,isbn))
          row=self.cur.fetchall()
          return row
  </code></pre>
  
  <p>My Frontend code is:</p>
  
  <pre><code>from tkinter import *
  from books_db import database
  
  db=database()
  class Window(object):
      def __init__(self,window):
              self.window=window
              self.window.wm_title("BOOK STORE")
  
      #############  ENTRIES.................
              self.title=Entry(window)
              self.title.grid(row=0,column=1)
  
  
              self.year=Entry(window)
              self.year.grid(row=1,column=1)
              self.yr=(int(self.year.get()))
  
              self.author=Entry(window)
              self.author.grid(row=0,column=3)
  
  
              self.isbn=Entry(window)
              self.isbn.grid(row=1,column=3)
              self.isb=(int(self.isbn.get()))
  
      ############  LISTBOX.................
              self.list=Listbox(window,height=6,width=35)
              self.list.grid(row=2,column=0,rowspan=6,columnspan=2)
  
      ########## BUTTONS...............
  
              b2=Button(window,text="SEARCH ENTRY",width=15,command=self.search_cmd)
              b2.grid(row=3,column=3)
  
  
      def search_cmd(self):
             self.list.delete(0,END)
             for item in db.search(self.title.get(),self.author.get(),self.yr,self.isb):
                 self.list.insert(END,item)
  
  
  
  window=Tk()
  Window(window)
  window.mainloop()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/dxHD7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dxHD7.png" alt="ValueError: invalid literal for int() with base 10: &#39; &#39;,on tkinter entry and Postgresql database"></a></p>