How to do it...

We will add a button and a label to our UI design. We will also use the Designer to connect the two, creating some of the available functionality directly within the Designer. Let's take a look at the steps:

  1. In the Designer, open Designer_Second_UI_layout.ui and save it as Designer_Second_UI_layout_button.ui.
  2. Drag a PushButton from the left-hand side into the lower horizontal layout:

Note how the button automatically adjusts itself to the left and right edges of the horizontal layout.

  1. Save and preview the UI. Click the button during the preview run of the UI:

When clicking it, the button looks pressed in and comes with ...

Get Python GUI Programming Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.