NameError: name "HORIZONTAL" not defined [Python Tkinter scale]

here is my code:

import Tkinter

top = Tkinter.Tk()
top.geometry('600x600')

scale = Tkinter.Scale(top,from_=10,to=40, orient=HORIZONTAL)
scale.pack()

      

There was an error with NameError: name 'HORIZONTAL' is not defined

I want my scale to be HORIZONTAL and I am referencing here but it doesn't work

+3


source to share


1 answer


HORIZONTAL

is a variable Tkinter

. If you want to use it you need to import it or use it likeTkinter.HORIZONTAL



If you don't want to add Tkinter

, you can dofrom Tkinter import HORIZONTAL

+4


source







All Articles