HOME/Articles/

tkinter example slider (snippet)

Article Outline

Python tkinter (gui) example 'slider'

Functions in program:

  • def show_values():

slider

Python tkinter example: slider

from tkinter import *


def show_values():
    print((w1.get(), w2.get()))

master = Tk()
w1 = Scale(master, from_=0, to=42, tickinterval=0)
w1.set(19)
w1.pack()
w2 = Scale(master, from_=0, to=200, length=600, tickinterval=10, orient=HORIZONTAL)
w2.set(23)
w2.pack()
Button(master, text='Show', command=show_values).pack()

mainloop()