PyQt5 Creating WHATISTHIS Class Widget

In this PyQt5 post i want to show you Creating of  WHATISTHIS Class Widget .  so first of all what is WHATISTHIS class in PyQt5 ?  WHATISTHIS class provides a description of the purpose of any widget, it is similar to QTooltip.

 

 

What is QWhatsThis ?

QWhatsThis is a class in PyQt5 that provides context sensitive help for widgets. when the user clicks the “What’s This?” button in a widget’s context menu, a help message is displayed in a pop-up window. The message is typically a short description of the widget’s purpose or instructions for how to use it.

 

 

Join PyQt5 Full Course for Free

PyQt5 Course

 

 

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 are going to create a QHBoxLayout object with QLabel. also we have added the label to the hbox layout.

 

 

 

So now we have created a QPushButton and we have used setWhatsThis() method for the button.

 

 

 

In here we need to set the layout for our main window and show the window.

 

 

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 Creating WHATISTHIS Class Widget

 

 

 

Run the complete code and this will be the result.

PyQt5 Creating WHATISTHIS Class Widget
PyQt5 Creating WHATISTHIS Class Widget

 

 

 

 

Also you can watch the complete video for this article.

Subscribe and Get Free Video Courses & Articles in your Email

 

Leave a Comment

Codeloop
Share via
Copy link
Powered by Social Snap
×