title: How to print into python tkinter entry field by pressing a button?
body: <p>So, i'm trying to create a program that creates a random number (using randint) to an entry field, when a button is pressed. But I can't figure out how to do it.</p>
  <pre><code>import tkinter
  from tkinter import Entry, END, E
  from random import randint
  
  root = tkinter.Tk()
  root.title('Number Generator')
  
  e = Entry(root, font=(&quot;LEMON MILK Bold&quot;, 24), width=15, borderwidth=10)
  e.grid(row=0, column=0, columnspan=3, padx=50, pady=50)
  e.delete(0, END)
  e.insert(0, number)
  
  number=print(randint(0, 100))
  
  #Definitions
  
  def button_generate():
      print(number)
  
  #Buttons
  
  button_generate = tkinter.Button(root, text=&quot;Random number&quot;, font=(&quot;LEMON MILK Bold&quot;, 24), padx=10, 
  pady=10, command=button_generate)
  button_exit = tkinter.Button(root, text=&quot;Exit&quot;, font=(&quot;LEMON MILK Bold&quot;, 14), padx=5, pady=5, 
  command=root.quit)
  
  #Grid
  
  button_generate.grid(row=1, column=0, columnspan=3)
  button_exit.grid(row=2, column=2, sticky=E)
  
  root.mainloop()
  </code></pre>
  <p>So basically how can I make the random number print into the entry field? (Right now it is not printing anywhere due to my bad code)</p>