test_textbox.py 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import customtkinter
  2. #customtkinter.set_widget_scaling(0.9)
  3. #customtkinter.set_window_scaling(0.9)
  4. customtkinter.set_appearance_mode("dark")
  5. app = customtkinter.CTk()
  6. app.title("test_scrollbar.py")
  7. app.geometry("800x1200")
  8. app.grid_rowconfigure(0, weight=1)
  9. app.grid_columnconfigure((0, 1, 2, 3, 4), weight=1)
  10. textbox_1 = customtkinter.CTkTextbox(app, fg_color=None, corner_radius=0, border_spacing=0)
  11. textbox_1.grid(row=0, column=0, sticky="nsew")
  12. textbox_1.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  13. frame_1 = customtkinter.CTkFrame(app, corner_radius=0)
  14. frame_1.grid(row=0, column=1, sticky="nsew")
  15. frame_1.grid_rowconfigure((0, 1, 2, 3, 4), weight=1)
  16. frame_1.grid_columnconfigure(0, weight=1)
  17. textbox_2 = customtkinter.CTkTextbox(frame_1, wrap="none")
  18. textbox_2.grid(row=0, column=0, sticky="nsew", padx=20, pady=20)
  19. textbox_2.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  20. textbox_2 = customtkinter.CTkTextbox(frame_1, wrap="none", corner_radius=30)
  21. textbox_2.grid(row=1, column=0, sticky="nsew", padx=20, pady=20)
  22. textbox_2.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  23. textbox_2 = customtkinter.CTkTextbox(frame_1, wrap="none", corner_radius=0, border_width=30)
  24. textbox_2.grid(row=2, column=0, sticky="nsew", padx=20, pady=20)
  25. textbox_2.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  26. textbox_2 = customtkinter.CTkTextbox(frame_1, wrap="none", corner_radius=60, border_width=15)
  27. #fg_color="blue", scrollbar_color="yellow", text_color="red")
  28. textbox_2.grid(row=3, column=0, sticky="nsew", padx=20, pady=20)
  29. textbox_2.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  30. textbox_2 = customtkinter.CTkTextbox(frame_1, wrap="none", corner_radius=0, border_width=0)
  31. textbox_2.grid(row=4, column=0, sticky="nsew", padx=20, pady=20)
  32. textbox_2.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  33. frame_2 = customtkinter.CTkFrame(app, corner_radius=0, fg_color=None)
  34. frame_2.grid(row=0, column=2, sticky="nsew")
  35. frame_2.grid_rowconfigure((0, 1, 2, 3, 4), weight=1)
  36. frame_2.grid_columnconfigure(0, weight=1)
  37. textbox_3 = customtkinter.CTkTextbox(frame_2)
  38. textbox_3.grid(row=0, column=0, sticky="nsew", padx=20, pady=20)
  39. textbox_3.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  40. textbox_3 = customtkinter.CTkTextbox(frame_2, corner_radius=30)
  41. textbox_3.grid(row=1, column=0, sticky="nsew", padx=20, pady=20)
  42. textbox_3.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  43. textbox_3 = customtkinter.CTkTextbox(frame_2, corner_radius=0, border_width=30)
  44. textbox_3.grid(row=2, column=0, sticky="nsew", padx=20, pady=20)
  45. textbox_3.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  46. textbox_3 = customtkinter.CTkTextbox(frame_2, corner_radius=60, border_width=15)
  47. textbox_3.grid(row=3, column=0, sticky="nsew", padx=20, pady=20)
  48. textbox_3.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  49. textbox_3 = customtkinter.CTkTextbox(frame_2, corner_radius=0, border_width=0, border_spacing=20)
  50. textbox_3.grid(row=4, column=0, sticky="nsew", padx=20, pady=20)
  51. textbox_3.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  52. frame_3 = customtkinter.CTkFrame(app, corner_radius=0, fg_color=None)
  53. frame_3.grid(row=0, column=3, sticky="nsew")
  54. frame_3.grid_rowconfigure((0, 1, 2, 3, 4), weight=1)
  55. frame_3.grid_columnconfigure(0, weight=1)
  56. textbox_3 = customtkinter.CTkTextbox(frame_3, activate_scrollbars=False)
  57. textbox_3.grid(row=0, column=0, sticky="nsew", padx=20, pady=20)
  58. textbox_3.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  59. textbox_3 = customtkinter.CTkTextbox(frame_3, corner_radius=10, border_width=2, activate_scrollbars=False)
  60. textbox_3.grid(row=1, column=0, sticky="nsew", padx=20, pady=20)
  61. textbox_3.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  62. textbox_3 = customtkinter.CTkTextbox(frame_3, corner_radius=0, border_width=2, activate_scrollbars=False)
  63. textbox_3.grid(row=2, column=0, sticky="nsew", padx=20, pady=20)
  64. textbox_3.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  65. textbox_3 = customtkinter.CTkTextbox(frame_3, corner_radius=0, border_width=2, activate_scrollbars=False)
  66. textbox_3.grid(row=3, column=0, sticky="nsew", padx=20, pady=20)
  67. textbox_3.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  68. textbox_3 = customtkinter.CTkTextbox(frame_3, corner_radius=0, border_width=0, activate_scrollbars=False, border_spacing=10)
  69. textbox_3.grid(row=4, column=0, sticky="nsew", padx=20, pady=20)
  70. textbox_3.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  71. textbox_4 = customtkinter.CTkTextbox(app, fg_color=None, corner_radius=0)
  72. textbox_4.grid(row=0, column=4, sticky="nsew")
  73. textbox_4.insert("0.0", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\n\n" * 20)
  74. scrollbar4 = customtkinter.CTkScrollbar(app, command=textbox_4.yview)
  75. scrollbar4.grid(row=0, column=5, sticky="nsew")
  76. textbox_4.configure(yscrollcommand=scrollbar4.set)
  77. # app.after(3000, lambda: customtkinter.set_appearance_mode("light"))
  78. app.mainloop()