Skip to content

Instantly share code, notes, and snippets.

@vigilantPotato
Created June 3, 2024 21:02
Show Gist options
  • Save vigilantPotato/8d08316079515b0652350e1f2a15300f to your computer and use it in GitHub Desktop.
Save vigilantPotato/8d08316079515b0652350e1f2a15300f to your computer and use it in GitHub Desktop.
How to use scale widget_2
import ctypes
import tkinter
def get_value():
current_value = scale.get()
b1["text"] = current_value
def set_value():
scale.set(0)
if __name__ == "__main__":
ctypes.windll.shcore.SetProcessDpiAwareness(1)
root = tkinter.Tk()
#Scale
scale = tkinter.Scale(
root,
orient="horizontal",
)
scale.pack()
#Button(get value)
b1 = tkinter.Button(
root,
widt=15,
text="get scale value",
command=get_value,
)
b1.pack()
#Button(reset)
b2 = tkinter.Button(
root,
widt=15,
text="Reset",
command=set_value,
)
b2.pack()
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment