test_progressbar_intermediate_mode.py 971 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import customtkinter
  2. import tkinter.ttk as ttk
  3. app = customtkinter.CTk()
  4. app.geometry("400x600")
  5. p1 = customtkinter.CTkProgressBar(app)
  6. p1.pack(pady=20)
  7. p2 = ttk.Progressbar(app)
  8. p2.pack(pady=20)
  9. s1 = customtkinter.CTkSlider(app, command=p1.set)
  10. s1.pack(pady=20)
  11. def switch_func():
  12. if sw1.get() == 1:
  13. p1.configure(mode="indeterminate")
  14. p2.configure(mode="indeterminate")
  15. else:
  16. p1.configure(mode="determinate")
  17. p2.configure(mode="determinate")
  18. def start():
  19. p1.start()
  20. p2.start()
  21. def stop():
  22. p1.stop()
  23. p2.stop()
  24. def step():
  25. p1.step()
  26. p2.step(10)
  27. sw1 = customtkinter.CTkSwitch(app, text="intermediate mode", command=switch_func)
  28. sw1.pack(pady=20)
  29. b1 = customtkinter.CTkButton(app, text="start", command=start)
  30. b1.pack(pady=20)
  31. b2 = customtkinter.CTkButton(app, text="stop", command=stop)
  32. b2.pack(pady=20)
  33. b3 = customtkinter.CTkButton(app, text="step", command=step)
  34. b3.pack(pady=20)
  35. app.mainloop()