use PyQt5 When , We often use it setWindowFlags To add properties to the window , Sometimes you want to use more than one logo at the same time . For example, the window should have no title bar and be fixed at the front , The required code is ：
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
At this point, someone will say , My code is the same, how can I only use one parameter ?
Here are two cases , One is correct , The other will report a mistake
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint) self.
setWindowFlag(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
See the difference ? Yes , Just one less ’s’, This is the difference between one and one or more . When I use it , This is what I started with , At that time, only one parameter is required , Later, when you need to add the second one, you will report an error . This one s I've been suffering for a long time , Take this as a warning .
And then I found the definition of two functions , It is found that these two functions are different in addition to this point
def setWindowFlag(self, Qt_WindowType, on=True): # real signature unknown;
restored from __doc__ """ setWindowFlag(self, Qt.WindowType, on: bool = True)
""" pass def setWindowFlags(self, Union, Qt_WindowFlags=None, Qt_WindowType=None
): # real signature unknown; restored from __doc__ """ setWindowFlags(self,
Union[Qt.WindowFlags, Qt.WindowType]) """ pass