title: Updating a Text widget live (while typing in it) using Tkinter
body: <p><strong>Problem:</strong> I have a Text widget which in my program is a password Text widget, and I would like it to type stars '*' instead of the text that's been writtin into it (updating while typing).</p>
  <h2>Code</h2>
  <pre><code>from tkinter import *
  
  root = Tk()
  
  # Changing the title and the size and the bg-color of the window #
  root.geometry(&quot;400x550&quot;)
  root.resizable(False, False)
  root.title(&quot;Registration form&quot;)
  root.configure(bg=&quot;#20c74c&quot;)
  
  # *THE LOGIN PAGE* - START #
  # The username &amp; password text-boxes and the submit button #
  username = Text(root, height=2, width=20)
  username.pack()
  username.place(relx=0.5, rely=0.5, anchor='center')
  
  password = Text(root, height=2, width=20)
  password.pack()
  password.place(relx=0.5, rely=0.4, anchor='center')
  
  
  # LOGIN FUNCTION #
  def login():
      acc = []  # This list will have two elements: first element (index position: 0) -&gt; username. Second element (index position: 1) will be -&gt; password.
      valid = &quot;&quot;
      file_length = 0
      length_reached = 0
  
      # A for loop to go through the text file row by row. (Each row has the username and the password, they're seperated by a single space).
      with open(r&quot;path&quot;, &quot;r&quot;) as added_to_file:
          for count in added_to_file:
              file_length += 1
  
      with open(r&quot;path&quot;, &quot;r&quot;) as file:
          for row in file:
              length_reached += 1
              acc = row.split(&quot; &quot;)
              if length_reached == file_length:
                  pass
              else:
                  acc[1] = acc[1][:-1]
              usern = username.get(1.0, END + &quot;-1c&quot;)
              passw = password.get(1.0, END + &quot;-1c&quot;)
              if passw == acc[0] and usern == acc[1]:
                  valid = &quot;Works!&quot;
                  print(valid)
                  break
              else:
                  pass
          if valid == &quot;&quot;:
              print(&quot;Account doesn't exist.&quot;)
  
  
  # The submit button #
  submit = Button(root, activebackground='#2c67c7', activeforeground='#fff', text='Login', command=login)
  submit.pack(ipadx=15, ipady=5)
  submit.place(relx=0.5, rely=0.6, anchor='center')
  
  # *THE LOGIN PAGE* - END #
  
  # Navigation system #
  register_frame = Frame(root, height=550, width=400, background='#20c74c')
  
  # *THE REGISTERATION PAGE* - START #
  # The username &amp; password text-boxes and the submit button #
  create_username = Text(register_frame, height=2, width=20)
  create_username.pack()
  create_username.place(relx=0.5, rely=0.4, anchor='center')
  
  create_password = Text(register_frame, height=2, width=20)
  create_password.pack()
  create_password.place(relx=0.5, rely=0.5, anchor='center')
  
  
  def register_button():
      with open(r&quot;path&quot;, &quot;a&quot;) as file:  # Opening the file in 'Append' mode to add the new account to the '.txt' file.
          new_usern = create_username.get(1.0, END + &quot;-1c&quot;)
          new_passw = create_password.get(1.0, END + &quot;-1c&quot;)
          account = f&quot;\n{new_usern} {new_passw}&quot;
          file.write(account)
  
  
  # The submit button #
  register = Button(register_frame, activebackground='#2c67c7', activeforeground='#fff', text='Confirm',
                    command=register_button)
  register.pack(ipadx=15, ipady=5)
  register.place(relx=0.5, rely=0.6, anchor='center')
  
  
  # *THE REGISTERATION PAGE* - END #
  
  
  def login_form():
      if register_page['background'] == '#383838':
          register_frame.pack_forget()
          register_page['background'] = '#fff'
          register_page['foreground'] = '#000'
          login_page['background'] = '#383838'
          login_page['foreground'] = '#fff'
      elif login_page['background'] == '#383838':
          pass
      else:
          register_page['background'] = '#fff'
          register_page['foreground'] = '#000'
  
  
  def reg_form():
      if login_page['background'] == '#383838':
          register_page['background'] = '#383838'
          register_page['foreground'] = '#fff'
          login_page['background'] = '#fff'
          login_page['foreground'] = '#000'
          register_frame.pack()
      elif register_page['background'] == '#383838':
          pass
      else:
          register_page['background'] = '#383838'
          login_page['background'] = '#fff'
          login_page['foreground'] = '#000'
          register_frame.pack()
  
  
  register_page = Button(root, text='Sign up', command=reg_form, background='#fff', foreground='#000')
  register_page.pack(ipadx=0.05, ipady=0.05)
  register_page.place(relx=0.01, rely=0.01)
  
  login_page = Button(root, text='Login', background='#383838', foreground='#fff', command=login_form)
  login_page.pack(ipadx=0.05, ipady=0.05)
  login_page.place(relx=0.15, rely=0.01)
  
  # Font variable #
  font_tuple = (&quot;Comic Sans MS&quot;, 16)
  userpass_font = (&quot;Roboto&quot;, 12)
  
  # Changing the font of some widgets #
  username.configure(font=userpass_font)
  password.configure(font=userpass_font)
  
  # The mainloop #
  mainloop()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/f1v7L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f1v7L.png" alt="So in this image you can see the program that I've made using Tkinter, and on the screen you can see an example of what I mean" /></a></p>
  <p>So if you know a solution to this problem your help would be very useful to me.</p>
  <ul>
  <li>One more thing that I need to mention, I don't know how to use Object Oriented Programing (OOP) yet, so a solution without using it would be great ^-^</li>
  </ul>