简体   繁体   English

如何使pyqt gui刷新

[英]How to make a pyqt gui refresh

I am making a GUI in pyqt which gets battery levels for a robot and then displays them.我正在 pyqt 中制作一个 GUI,它获取机器人的电池电量,然后显示它们。 The GUI would therefore have to constantly update its battery level displays (which are displayed using QProgressBar).因此,GUI 必须不断更新其电池电量显示(使用 QProgressBar 显示)。

However, if I were to put the progress bars in a loop, it makes infinite copies of the graphics and stacks them on top of each other.但是,如果我将进度条放在一个循环中,它会无限复制图形并将它们堆叠在一起。 How might I make the progress bars refresh without making additional copies?如何在不制作额外副本的情况下刷新进度条? Is there a way to delete everything in the loop after each recurrence?有没有办法在每次重复后删除循环中的所有内容?

将进度条设为全局变量,并让另一个线程调用更新进度方法,不要复制进度条本身。

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

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