title: Messagebox for existed student id
body: <p>I have built a student registration record in Tkinter, if the users fail to input the student id, student name, student email and student courses the app will remind the user of a message. What if the user has input a student id which exists in the student database, the app will also warn the user the student id has existed, they have to input another id. How to code that part, in order for the app to render such a message?
  <a href="https://i.stack.imgur.com/fo4gC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fo4gC.jpg" alt="enter image description here" /></a></p>
  <p>The following is part of my code.</p>
  <p>def add_student_data():</p>
  <pre><code>if student_id.get() == '':
      messagebox.showwarning(title='warning',message='Please Fill In The Student Id!')
  
  elif student_name.get() == '':
      messagebox.showwarning(title='warning',message='Please Fill In The Student Name!')
      
  elif student_email.get() == '':
      messagebox.showwarning(title='warning',message='Please Fill In The Student Email!')     
       
  elif student_courses.get() == '': 
      messagebox.showwarning(title='warning',message='Please Fill In The Student Courses!')
  
  elif student_id.get() == record_table.parent(item=(record[1])):
      messagebox.showerror(title='Student Id error', message='The  Student ID was exist!')
      
  else:
      conn = sqlite3.connect('media/students.db')
      
      c = conn.cursor()
      
      c.execute(&quot;INSERT INTO student VALUES (:id, :name, :email, :courses)&quot;,
                  {
                  'id': student_id.get(),
                  'name': student_name.get(),
                  'email': student_email.get(),
                  'courses':student_courses.get(),
                  })
      
      conn.commit()
      conn.close()
      
      record_table.tag_configure('oddrow', background = 'white')
      record_table.tag_configure('evenrow', background = 'light pink')
      
      global count
      if count % 2 == 0: 
          record_table.insert(parent='', index='end', iid=count, text='', values=(student_id.get(), 
                                                                                  student_name.get(), 
                                                                                  student_email.get(), 
                                                                                  student_courses.get()),tags=('evenrow', ))
      else:
          record_table.insert(parent='', index='end', iid=count, text='', values=(student_id.get(), 
                                                                                  student_name.get(), 
                                                                                  student_email.get(), 
                                                                                  student_courses.get()), tags=('oddrow', ))
      count += 1
      
      student_id.delete(0, 'end')
      student_name.delete(0, 'end')
      student_email.delete(0, 'end')
      student_courses.delete(0, 'end')
      
      record_table.delete(*record_table.get_children())
  </code></pre>