Created
June 3, 2024 21:02
-
-
Save vigilantPotato/8d08316079515b0652350e1f2a15300f to your computer and use it in GitHub Desktop.
How to use scale widget_2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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