Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Creating PyQt Layouts for GUI Applications (Summary)

Creating high-quality GUI applications requires laying out all the graphical components in a coherent and polished arrangement. In PyQt, an effective way of doing that is to use PyQt’s layout managers, which provide a user-friendly and productive way of approaching this task.

In this course, you’ve learned:

  • What the benefits are of properly laying out the widgets on a GUI
  • How to programmatically arrange widgets using PyQt’s built-in layout managers
  • Which layout manager to use for your specific use case
  • How to lay out main window–style and dialog-style applications in PyQt

Here are additional resources about PyQt:


Sample Code (.zip)

9.4 KB


Course Slides (.pdf)

3.2 MB

00:00 All right! That was quite a few different lessons, and if you have gotten that far, you should have learned a lot about PyQt and about how to lay out widgets on the GUI.

00:09 But let’s talk through what we have covered over the last couple of videos, just to wrap this entire thing out. We started with a basic outline of what the problem of GUIs is.

00:18 And the problem is that you don’t have control over how your user is going to use your app. All this really means is that you have to have a flexible GUI that can respond to basically any scenario and any kind of device.

00:31 To account for that, we have learned about layout managers. In the beginning, we have learned about four basic ones: QHBoxLayout and QVBoxLayout, QGridLayout and QFormLayout.

00:43 And those already gave us quite a few different options. Then we also learned how to combine different layout managers and how to add space in between them. After we covered that, we talked about widgets that can hide different elements on the screen so you only show the user specific content that you want to be visible.

01:01 And for that, we have seen two additional layout managers: QStackedLayout, and QTabWidget. Those are also fairly straightforward when it comes down to it.

01:10 QStackedLayout creates pages that you can switch between, and QTabWidget gives you tabs that the user can switch in between. And that’s pretty much it! If you have gotten that far, you should be reasonably confident to create basically any kind of GUI at this point. Although, obviously, it really helps to practice this quite a bit.

01:28 And, of course, if you want to learn more, you can check out the PyQt learning path. There are lots more videos for more advanced topics. Again, you can find the link below this video. All right!

01:38 I hope you enjoyed this course, and I will see you around!

Ghani on Feb. 19, 2021

Very nice course. Thanks

Become a Member to join the conversation.