PyQt5 QDial Example With valueChanged Signal

In this PyQt5 article i want to show creating QDial Example With valueChanged Signal, also iam going to show you can connect valueChanged Signal with PyQt5 slot. QDial class provides a rounded range control (like a speedometer or potentiometer). QDial is used when the user needs to control a value within a program-definable range, and the range either wraps around (for example, with angles measured from 0 to 359 degrees) or the dialog layout needs a square widget.

 

 

 

What is PyQt5 QDial ?

PyQt5 QDial is graphical user interface (GUI) widget provided by the PyQt5 library. it is  circular dial that can be rotated by the user to select a value within range of values. QDial widget is often used as a user interface control for adjusting values such as volume or brightness.

PyQt5 QDial widget provides several properties that allow the developer to customize its appearance and behavior. for example minimum and maximum values of the dial can be set, as well as the current value. the widget can also be set to either wrap around when the maximum or minimum values are reached or to stop at the limits.

Also PyQt5 QDial widget provides several signals that can be used to respond to user interaction with the dial. for example valueChanged signal is emitted whenever the user rotates the dial to a new value.

So we can say that PyQt5 QDial is useful widget for creating interactive GUI applications with a circular dial interface.

 

 

 

Also you can read more Python GUI articles in the below links

 

 

 

First we need some imports.

 

 

 

After that we are going to create our main Window class that extends from QWidget. and in the constructor of the class we need to add some requirements of the window like set window title, window icon and window geometry.

 

 

 

In here we have created the object of QVBoxLayout and also QLabel.

 

 

 

We also change the font of our QLabel using this code.

 

 

 

And now we create our QDial. we set the maximum and minimum value for the qdial.

 

 

 

In here we have connected the valueChanged signal of QDial with dialer_changed() slot or method.

 

 

 

Now we create our slot for connecting to valueChanged Signal. first we are going to get the value from QDial and after that we set the value to the label.

 

 

 

Also every PyQt5 application must create an application object. 

 

 

 

Finally, we enter the mainloop of the application. The event handling starts from this point. 

 

 

 

 

 

Complete source code PyQt5 QDial Example With valueChanged Signal

 

 

 

 

Run the code and this is the result

PyQt5 QDial Example With valueChanged Signal
PyQt5 QDial Example With valueChanged Signal

 

 

 

 

Also you can watch the complete video for this article

Subscribe and Get Free Video Courses & Articles in your Email

 

Leave a Comment

Share via
Copy link
Powered by Social Snap
×