Skip to content

Instantly share code, notes, and snippets.

@vigilantPotato
Created May 28, 2024 22:04
Show Gist options
  • Save vigilantPotato/1657195aed333888d1f43c5b89c38cac to your computer and use it in GitHub Desktop.
Save vigilantPotato/1657195aed333888d1f43c5b89c38cac to your computer and use it in GitHub Desktop.
How to use spinbox_1
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