![Python GUI Programming Cookbook(Second Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/163/36701163/b_36701163.jpg)
上QQ阅读APP看书,第一时间看更新
How to do it...
The procedural way of adding spacing around widgets is shown first, and then we will use a loop to achieve the same thing in a much better way.
Our LabelFrame looks a bit tight as it blends into the main window towards the bottom. Let's fix this now.
Modify line 110 of the code snippet from GUI_LabelFrame_column_one.py in the previous recipe by adding padx and pady. You can also find the code in:
GUI_add_padding.py
![](https://epubservercos.yuewen.com/A95289/19470408908965106/epubprivate/OEBPS/Images/Code_GUI_LabelFrame_padxy.png?sign=1738917354-9qw6iXCFA6SKLNbzjSa3F5hr2m8CLWUj-0-a4c74201b4430298038cdec0c1c61a8b)
Now, our LabelFrame gets some breathing space:
![](https://epubservercos.yuewen.com/A95289/19470408908965106/epubprivate/OEBPS/Images/GUI_add_padding.png?sign=1738917354-w0ay7mzNTJWmxPaBqJrb6dacBmcYC5YW-0-73e49b4ce3394633c2ffa40ce1e03d74)