PyQt5 GUI Creating QScrollArea Example

In this PyQt5 GUI article i want to show you Creating QScrollArea. The QScrollArea class provides a scrolling view onto another widget.A scroll area is used to display the contents of a child widget within a frame. If the widget exceeds the size of the frame, the view can provide scroll bars so that the entire area of the child widget can be viewed.

 

 

 

Also you can check more Python articles in the below links

1: Complete PyQt5 GUI Development Course

2: Python TKinter GUI Development 

3: Psyide2 GUI Development 

4: wxPython GUI Development 

 

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.

and in the constructor we have added a val, because we want to add some value in there.

 

 

 

 

In here we going to create the object of QFormLayout and QGroupBox. also we have created two empty lists.

 

 

 

Using this code we want to create some buttons to add in the window for testing the scroll of the window.

 

 

 

 

 

Also every PyQt5 application must create an application object. The sys.argv parameter is a list of arguments from a command line.

 

 

 

Finally, we enter the mainloop of the application. The event handling starts from this point. The mainloop receives events from the window system and dispatches them to the application widgets. also we have created the object of window and we have added 30, because we want 30 buttons.

 

 

 

 

Run the complete code and this will be the result

 

PyQt5 GUI Creating QScrollArea Example
PyQt5 GUI Creating QScrollArea Example

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Complete source code for PyQt5 GUI Creating QScrollArea Example

 

 

 

 

 

Also you can check the complete video for this article

 

(Visited 4,558 times, 11 visits today)
Share via
Copy link
Powered by Social Snap