title: How can I resolve the tcl error in tkinter
body: <p>When I run the file add books it works fine but when I import the file &quot;add books&quot; inside another file &quot;main.py&quot; I am getting an error.
  In the &quot;add book&quot; file I have used a image &quot;SISHYA SCHOOL blur.png&quot; this is the background for my program.
  Now if I run the file &quot;add book&quot; I am getting output like
  <a href="https://i.stack.imgur.com/waShf.png" rel="nofollow noreferrer">output image</a></p>
  <p>But when I am importing the &quot;add book&quot; file to another file &quot;main.py&quot;
  the background image doesn't get displayed in the output
  <a href="https://i.stack.imgur.com/dKLF2.png" rel="nofollow noreferrer">this is the main.py code snippet</a></p>
  <p><a href="https://i.stack.imgur.com/OssDh.png" rel="nofollow noreferrer">This is the error I am getting</a></p>
  <pre><code>def addBook(): 
  
  global bookInfo1 ,bookInfo2, bookInfo3, bookInfo4, Canvas1, con, cur, bookTable, root
  
  mypass = &quot;*****&quot;
  mydatabase=&quot;db&quot;
  
  con = pymysql.connect( host=&quot;localhost&quot;, user=&quot;root&quot;, password=mypass, database=mydatabase)
  cur = con.cursor()
  
  # Enter Table Names here
  bookTable = &quot;books&quot; # Book Table    
  
  root = Tk()
  root.title(&quot;Library&quot;)
  root.geometry(&quot;600x500&quot;)
  
  background = PhotoImage(file =&quot;F:\\12th project\\img\\SISHYA SCHOOL blur.png&quot;)
  bg1_label = Label(root, image = background) 
  bg1_label.place(x = 0, y = 0)
  
  # Book ID
  lb1 = Label(root, text=&quot;Book ID : &quot;, bg='black', fg='white')
  lb1.place(relx=0.05, rely=0.2, relheight=0.08)
  
  bookInfo1 = Entry(root)
  bookInfo1.place(relx=0.3, rely=0.2, relwidth=0.62, relheight=0.08)
  
  # Title
  lb2 = Label(root, text=&quot;Title : &quot;, bg='black', fg='white')
  lb2.place(relx=0.05, rely=0.35, relheight=0.08)
  
  bookInfo2 = Entry(root)
  bookInfo2.place(relx=0.3, rely=0.35, relwidth=0.62, relheight=0.08)
  
  # Book Author
  lb3 = Label(root, text=&quot;Author : &quot;, bg='black', fg='white')
  lb3.place(relx=0.05, rely=0.50, relheight=0.08)
  
  bookInfo3 = Entry(root)
  bookInfo3.place(relx=0.3, rely=0.50, relwidth=0.62, relheight=0.08)
  
  # Book Status
  lb4 = Label(root, text=&quot;Status(Avail/issued) : &quot;, bg='black', fg='white')
  lb4.place(relx=0.05, rely=0.65, relheight=0.08)
  
  bookInfo4 = Entry(root)
  bookInfo4.place(relx=0.3, rely=0.65, relwidth=0.62, relheight=0.08)
  
  #Submit Button
  SubmitBtn = Button(root, text=&quot;SUBMIT&quot;, bg='#d1ccc0', fg='black', command=bookRegister)
  SubmitBtn.place(relx=0.28, rely=0.9, relwidth=0.18, relheight=0.08)
  
  quitBtn = Button(root, text=&quot;Quit&quot;, bg='#f7f1e3', fg='black', command=root.destroy)
  quitBtn.place(relx=0.53, rely=0.9, relwidth=0.18, relheight=0.08)
  
  root.mainloop()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/kih42.png" rel="nofollow noreferrer">Tthis is the code snippet of add book</a></p>