In this article, we will see how we can get orientation property of QDial. This property holds the orientation of the slider, the orientation must be Vertical (the default) or Horizontal. For vertical orientation associated value is 2 and for horizontal orientation, it is 1, it can be set to the QDial with the help of setOrientation method.
In order to do this we use orientation method with the QDial object
Syntax : dial.orientation()
Argument : It takes no argument
Return : It returns Orientation object but when printed it shows the associated value of orientation
Below is the implementation
# importing libraries from PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGui from PyQt5.QtGui import * from PyQt5.QtCore import * import sys class Window(QMainWindow): def __init__(self): super().__init__() # setting title self.setWindowTitle("Python ") # setting geometry self.setGeometry(100, 100, 500, 400) # calling method self.UiComponents() # showing all the widgets self.show() # method for components def UiComponents(self): # creating QDial object dial = QDial(self) # setting geometry to the dial dial.setGeometry(100, 100, 100, 100) # making notch visible dial.setNotchesVisible(True) # setting orientation to it dial.setOrientation(Qt.Horizontal) # creating a label label = QLabel("GeeksforGeeks", self) # setting geometry to the label label.setGeometry(220, 125, 200, 60) # making label multiline label.setWordWrap(True) # getting orientation value = dial.orientation() # setting text to the label label.setText("Orientation : " + str(value)) # create pyqt5 app App = QApplication(sys.argv) # create the instance of our Window window = Window() # start the app sys.exit(App.exec()) |
Output :

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
Recommended Posts:
- PyQt5 QDial - Setting Orientation Property
- PyQt5 QDial - Getting Wrapping Property
- PyQt5 QDial - Getting Notch Visible Property
- PyQt5 QDial - Getting Lower Bound
- PyQt5 QDial - Getting Upper Bound
- PyQt5 QDial - Getting Slider's Value
- PyQt5 QScrollBar – Getting its Orientation
- PyQt5 QDial - Setting Wrapping Property
- PyQt5 QDial - Setting Lower Bound of it
- PyQt5 QDial - Setting Upper Bound
- PyQt5 QDial - Setting Range of Dial
- PyQt5 QDial - Setting Slider's Value
- PyQt5 QDial - Slider's Value Changed Signal
- PyQt5 - QDial
- PyQt5 QDial - Making Notch Visible
- PyQt5 QDial - Range Changed Signal
- PyQt5 - orientation() method Progress Bar
- PyQt5 QScrollBar – Changing its Orientation
- wxPython - Create Radio Box with Items in different orientation
- PyQt5 QSpinBox - Getting property value
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

