fixed simple_example.py

This commit is contained in:
Tom Schimansky 2022-03-05 13:21:53 +01:00
parent 0d32213325
commit 7d774c9843
2 changed files with 17 additions and 12 deletions

View File

@ -5,7 +5,7 @@ customtkinter.set_appearance_mode("System") # Modes: "System" (standard), "Dark
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
root_tk = customtkinter.CTk() # create CTk window like you do with the Tk window (you can also use normal tkinter.Tk window)
root_tk.geometry("400x340")
root_tk.geometry("400x440")
root_tk.title("CustomTkinter Test")

View File

@ -1,14 +1,8 @@
#import tkinter.ttk as ttk
import ctypes
print(ctypes.windll.shcore.SetProcessDpiAwareness(ctypes.c_int(1)))
import tkinter.ttk as ttk
import tkinter
app = tkinter.Tk()
print(app.winfo_fpixels('1i'))
#app.tk.call('tk', 'scaling', 1.0)
print(app.winfo_fpixels('1i'))
app.geometry("400x300")
app.geometry("400x350")
app.title("Standard Tkinter Test")
@ -20,6 +14,9 @@ def slider_function(value):
progressbar_1["value"] = value
s = ttk.Style()
s.configure("TRadiobutton", fg="red")
y_padding = 6
frame_1 = tkinter.Frame(master=app, width=300, height=260, bg="lightgray")
@ -28,9 +25,9 @@ frame_1.pack(padx=60, pady=20, fill="both", expand=True)
label_1 = tkinter.Label(master=frame_1, text="Label", bg="lightgray")
label_1.pack(pady=y_padding, padx=10)
#progressbar_1 = ttk.Progressbar(master=frame_1,style='black.Horizontal.TProgressbar', length=150)
#progressbar_1.pack(pady=y_padding, padx=10)
#progressbar_1["value"] = 50
progressbar_1 = ttk.Progressbar(master=frame_1, style='black.Horizontal.TProgressbar', length=150)
progressbar_1.pack(pady=y_padding, padx=10)
progressbar_1["value"] = 50
button_1 = tkinter.Button(master=frame_1, command=button_function, text="Button", highlightbackground="lightgray")
button_1.pack(pady=y_padding, padx=10)
@ -44,4 +41,12 @@ entry_1.pack(pady=y_padding, padx=10)
checkbox_1 = tkinter.Checkbutton(master=frame_1, bg=frame_1.cget("bg"), text="CheckButton")
checkbox_1.pack(pady=y_padding, padx=10)
radiobutton_var = tkinter.IntVar()
radiobutton_1 = ttk.Radiobutton(master=frame_1, variable=radiobutton_var, value=1, text="Radiobutton")
radiobutton_1.pack(pady=y_padding, padx=10)
radiobutton_2 = ttk.Radiobutton(master=frame_1, variable=radiobutton_var, value=2, text="Radiobutton")
radiobutton_2.pack(pady=y_padding, padx=10)
app.mainloop()