PyQt-如何检查QDialog是否可见? [英] PyQt - How to check is QDialog is visible?

查看:193
本文介绍了PyQt-如何检查QDialog是否可见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题.我有以下代码:

I have a problem. I have this code:

balls = [Ball() for i in range(1, 10)]

因此,当我说Ball()时,它将在QDialog上绘制一个球.然后,完成此操作后,我将无限循环地围绕QDialog移动这些球.我想说的是QDialog.isVisible()移动它们.

So, when I say Ball() this will draw a ball on QDialog. And then when this is done, I am moving the balls around QDialog in an infinite loop. I want to say something like while QDialog.isVisible() move them around.

我没有任何父对话框或窗体,也没有任何子对话框或窗体.一切都与此QDialog有关.我知道对QDialog进行操作很愚蠢,但是除QDialog之外,我不允许使用其他任何内容.

I don't have any parent dialog or form or any child dialog or form. It's all just about this QDialog. I know that it's stupid to do with QDialog, but I am not allowed to use anything else than just QDialog.

推荐答案

您可以从QWidget使用isVisible,因为QDialog基本上继承了QWidget.因此,您应该能够检查可见性.

You can use isVisible from QWidget because QDialog basically inherits QWidget. So you should be able to check the visibility.

myDialog = QtGui.QDialog()
isVis = myDialog.isVisible()

有关更多详细信息, http://www.riverbankcomputing .co.uk/static/Docs/PyQt4/html/qwidget.html#isVisible

这篇关于PyQt-如何检查QDialog是否可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆