<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I'm using PyQt 5.8 and trying to detect a window's state by comparing it to known window states using '&', but every comparison returns False.<br class=""><br class="">For example:<br class=""><br class=""><blockquote type="cite" class="">if win.windowState() & Qt.WindowNoState:<br class=""> print("normal")<br class="">elif win.windowState() & Qt.WindowMinimized:<br class=""> print("minimized")<br class="">elif win.windowState() & Qt.WindowMaximized:<br class=""> print("maximized")<br class="">else:<br class=""> raise NotImplementedError<br class=""></blockquote><br class="">However, the comparison is always false (so I hit the exception), even though <i class="">print(int(win.windowState()), int(Qt.WindowNoState))</i> shows "0 0".<br class=""><br class="">The same syntax for other QFlags seems to work fine:<br class=""><br class=""><blockquote type="cite" class="">if win.windowType() & Qt.Widget:<br class=""> print("widget")<br class="">elif win.windowType() & Qt.Window:<br class=""> print("window")<br class="">else:<br class=""> raise NotImplementedError</blockquote><br class="">My IDE, PyCharm, believes that the & operator is not defined for the WindowStates class and gives me a warning: `<i class="">'WindowStates' does not define '__and__', so the '&' operator cannot be used on its instances</i>`. I can't seem to find the 5.8 documentation for this enum, but looking at the PyQt4 documentation (<a href="http://pyqt.sourceforge.net/Docs/PyQt4/qt-windowstates.html#__and__" class="">http://pyqt.sourceforge.net/Docs/PyQt4/qt-windowstates.html#__and__</a>) it is defined.<br class=""><br class="">Is bitwise comparison not available for the WindowStates enum? Or am I checking it incorrectly?<br class=""><br class="">Thanks!<br class="">Jayson</body></html>