Wednesday, March 20, 2013

Implement Scale bar of Tkinter

Scale bar of Tkinter
Scale bar of Tkinter


#tkinter for Python 3.x
#Tkinter for Python 2.x

import tkinter

def quit():
    global tkTop
    tkTop.destroy()

tkTop = tkinter.Tk()
tkTop.geometry('300x200')

tkButtonQuit = tkinter.Button(tkTop, text="Quit", command=quit)
tkButtonQuit.pack()

tkScale = tkinter.Scale(tkTop, from_=1, to=30, orient=tkinter.HORIZONTAL)
tkScale.set(18)
tkScale.pack(anchor=tkinter.CENTER)

tkinter.mainloop()