Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyQt - How to check is QDialog is visible?

I have a problem. I have this code:

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

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.

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.

like image 687
golobitch Avatar asked Dec 04 '25 11:12

golobitch


1 Answers

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()

For more details http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwidget.html#isVisible

like image 65
Achayan Avatar answered Dec 06 '25 04:12

Achayan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!