text_entry_placeholder.py 856 B

123456789101112131415161718192021222324252627
  1. import customtkinter
  2. app = customtkinter.CTk() # create CTk window like you do with the Tk window (you can also use normal tkinter.Tk window)
  3. app.geometry("400x400")
  4. app.title("test_entry_placeholder.py")
  5. str_var = customtkinter.StringVar(value="test")
  6. entry_1 = customtkinter.CTkEntry(app, placeholder_text="placeholder", textvariable=str_var)
  7. entry_1.pack(pady=20)
  8. entry_2 = customtkinter.CTkEntry(app, placeholder_text="placeholder", textvariable=str_var)
  9. entry_2.pack(pady=20)
  10. entry_2.insert(0, "sdfjk ")
  11. entry_2.delete(0, 2)
  12. entry_3 = customtkinter.CTkEntry(app, placeholder_text="placeholder")
  13. entry_3.pack(pady=(40, 20))
  14. entry_3.insert(0, "sdfjk")
  15. entry_3.delete(0, "end")
  16. entry_4 = customtkinter.CTkEntry(app, placeholder_text="password", show="*")
  17. entry_4.pack(pady=(20, 20))
  18. entry_4.insert(0, "sdfjk")
  19. entry_4.delete(0, 2)
  20. app.mainloop()