简体   繁体   English

动态添加几个小部件 PyQt5

[英]Add several widgets dynamically PyQt5

I designed a simple download manager on qt designer and would like to add several widgets(specifically the lower portion of the window the one containing the progress bar and the pushbuttons)我在 qt 设计器上设计了一个简单的下载管理器,并想添加几个小部件(特别是 window 的下部包含进度条和按钮) 在此处输入图像描述

My question is, Is it possible?我的问题是,有可能吗? If so, How can I implement such a design?如果是这样,我该如何实现这样的设计? and if someone can direct me to an article or a website that has answered that kind of question before?如果有人可以引导我访问以前回答过此类问题的文章或网站?

You can add widgets (and layouts) dynamically to any layout.您可以将小部件(和布局)动态添加到任何布局。 Just create instance and call addWidget()只需创建实例并调用addWidget()

button = QPushButton()
ui.some_layout.addWidget(button)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM