Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting `orient` keyword argument for Tkinter Scale widget results in NameError: name 'HORIZONTAL' is not defined

Here is my code:

import Tkinter

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

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

The following error appeared:

NameError: name 'HORIZONTAL' is not defined

I want to set my scale to be horizontal, and my reference is here but it doesn't work.

like image 439
user2666750 Avatar asked Mar 19 '23 02:03

user2666750


1 Answers

HORIZONTAL is Tkinter's variable. If you want to use it you have to import it or have to use like Tkinter.HORIZONTAL

If you dont want to add Tkinter then you can do from Tkinter import HORIZONTAL

like image 118
Nilesh Avatar answered Mar 26 '23 01:03

Nilesh