Tkinter Scale – Horizontal Orientation

Tkinter Scale – Orient Horizontal

In Tkinter, the default orientation of the Scale widget is Vertical. But, you can set this orientation to Horizontal using the orient option of the Scale widget.

To set the orientation of the Scale widget to Horizontal in Tkinter, set the orient option with tkinter.HORIZONTAL, as shown in the following.

orient option set to HORIZONTAL when creating the Scale widget.

scale_1 = tk.Scale(window, orient=tk.HORIZONTAL)

orient option set to HORIZONTAL, after creating the Scale widget.

scale_1 = tk.Scale(window)
scale_1['orient'] = tk.HORIZONTAL

In this tutorial, you shall learn how to set the horizontal orientation for a Scale widget in Tkinter, with examples.

Example

In this example, we shall create a Scale widget scale_1 with horizontal orientation.

Python Program

import tkinter as tk

# Create the main window
window = tk.Tk()
window.geometry("300x200")
window.title("PythonExamples.org")

# Create a Scale widget
scale_1 = tk.Scale(window, orient=tk.HORIZONTAL)
scale_1.pack()

# Start the Tkinter event loop
window.mainloop()
Copy

Output in MacOS

Tkinter Scale - Horizontal Orientation
Tkinter Scale with Horizontal Orientation

Summary

In this Python Tkinter tutorial, we have seen how to set the orientation of the Scale widget to Horizontal in Tkinter, with examples.

Related Tutorials

Code copied to clipboard successfully 👍