simple_example_standard_tkinter.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import tkinter.ttk as ttk
  2. import tkinter
  3. app = tkinter.Tk()
  4. app.geometry("400x350")
  5. app.title("simple_example_standard_tkinter.py")
  6. def button_function():
  7. print("button pressed")
  8. def slider_function(value):
  9. progressbar_1["value"] = value
  10. s = ttk.Style()
  11. s.configure("TRadiobutton", fg="red")
  12. y_padding = 6
  13. frame_1 = tkinter.Frame(master=app, width=300, height=260, bg="lightgray")
  14. frame_1.pack(padx=60, pady=20, fill="both", expand=True)
  15. label_1 = tkinter.Label(master=frame_1, text="Label", bg="lightgray")
  16. label_1.pack(pady=y_padding, padx=10)
  17. progressbar_1 = ttk.Progressbar(master=frame_1, style='black.Horizontal.TProgressbar', length=150)
  18. progressbar_1.pack(pady=y_padding, padx=10)
  19. progressbar_1["value"] = 50
  20. button_1 = tkinter.Button(master=frame_1, command=button_function, text="Button", highlightbackground="lightgray")
  21. button_1.pack(pady=y_padding, padx=10)
  22. slider_1 = tkinter.Scale(master=frame_1, command=slider_function, orient="horizontal", bg="lightgray", length=150)
  23. slider_1.pack(pady=y_padding, padx=10)
  24. entry_1 = tkinter.Entry(master=frame_1, highlightbackground="lightgray", width=10)
  25. entry_1.pack(pady=y_padding, padx=10)
  26. checkbox_1 = tkinter.Checkbutton(master=frame_1, bg=frame_1.cget("bg"), text="CheckButton")
  27. checkbox_1.pack(pady=y_padding, padx=10)
  28. radiobutton_var = tkinter.IntVar()
  29. radiobutton_1 = ttk.Radiobutton(master=frame_1, variable=radiobutton_var, value=1, text="Radiobutton")
  30. radiobutton_1.pack(pady=y_padding, padx=10)
  31. radiobutton_2 = ttk.Radiobutton(master=frame_1, variable=radiobutton_var, value=2, text="Radiobutton")
  32. radiobutton_2.pack(pady=y_padding, padx=10)
  33. app.mainloop()