test_ctk_button.py 954 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import time
  2. import customtkinter
  3. class TestCTkButton():
  4. def __init__(self):
  5. self.root_ctk = customtkinter.CTk()
  6. self.ctk_button = customtkinter.CTkButton(self.root_ctk)
  7. self.ctk_button.pack(padx=20, pady=20)
  8. self.root_ctk.title(self.__class__.__name__)
  9. def clean(self):
  10. self.root_ctk.quit()
  11. self.root_ctk.withdraw()
  12. def main(self):
  13. self.execute_tests()
  14. self.root_ctk.mainloop()
  15. def execute_tests(self):
  16. print(f"\n{self.__class__.__name__} started:")
  17. start_time = 0
  18. self.root_ctk.after(start_time, self.test_iconify)
  19. start_time += 1500
  20. self.root_ctk.after(start_time, self.clean)
  21. def test_iconify(self):
  22. print(" -> test_iconify: ", end="")
  23. self.root_ctk.iconify()
  24. self.root_ctk.after(100, self.root_ctk.deiconify)
  25. print("successful")
  26. if __name__ == "__main__":
  27. TestCTkButton().main()