[英]Splash window and always on top at the same time in pyqt4?
In pyqt4, I can use setWindowFlags(Qt.SplashScreen)
so the window have no title bar. 在pyqt4中,我可以使用
setWindowFlags(Qt.SplashScreen)
因此窗口没有标题栏。
And use setWindowFlags(Qt.WindowStaysOnTopHint)
to make window always stays on top. 并使用
setWindowFlags(Qt.WindowStaysOnTopHint)
使窗口始终位于顶部。
But what if I want them both? 但是,如果我两个都想要怎么办? No title bar and stays on top at the same time.
没有标题栏,并且同时位于顶部。
Is there a way to achieve that...? 有没有办法实现...?
Whenever you want to apply multiple flags, you should use the |
每当您要应用多个标志时,都应使用
|
operator, which is the binary or operator. 运算符,它是二进制或运算符。 This will allow multiple flags as @ekhumoro said, so a simple example would be:
如@ekhumoro所说,这将允许多个标志,所以一个简单的例子是:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
class MyWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.resize(640,480)
self.setWindowFlags(Qt.SplashScreen | Qt.WindowStaysOnTopHint)
if __name__=="__main__":
app=QApplication(sys.argv)
win=MyWindow()
win.show()
sys.exit(app.exec_())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.