Created
May 28, 2024 22:04
-
-
Save vigilantPotato/1657195aed333888d1f43c5b89c38cac to your computer and use it in GitHub Desktop.
How to use spinbox_1
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 | |
from tkinter import ttk | |
def show_current_value(): | |
label["text"] = "current value is " + spinbox.get() | |
if __name__ == "__main__": | |
ctypes.windll.shcore.SetProcessDpiAwareness(1) | |
root = tkinter.Tk() | |
#label | |
label = tkinter.Label( | |
root, | |
width=15, | |
bg="lightblue", | |
) | |
label.pack() | |
#spinbox | |
spinbox = tkinter.Spinbox( | |
root, | |
from_=-10, to=10, increment=1, | |
command=show_current_value, | |
state="readonly", | |
width=15, | |
) | |
spinbox.pack() | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment