我想像使用set_keep_above(True)一样使用GTK保持PyQt4窗口。
这可能吗?
编辑 20111101:这是我的代码,我不知道如何强制窗口“上方”:
#!/usr/bin/python2
# -*- coding: utf8 -*-
import os, sys, signal
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
from PyQt4.QtScript import *
from PyQt4.QtNetwork import *
if os.path.exists(".forum_smileys_cache"):
pass
else:
os.mkdir(".forum_smileys_cache")
app = QApplication(sys.argv)
signal.signal(signal.SIGINT, signal.SIG_DFL)
webpage = QWebView()
webpage.setWindowTitle("forums smileys code")
manager = webpage.page().networkAccessManager()
diskCache = QNetworkDiskCache(webpage)
diskCache.setCacheDirectory(".forum_smileys_cache")
manager.setCache(diskCache)
webpage.show()
webpage.setGeometry(0,0, 300, 550)
webpage.resize(250,800)
webpage.load(QUrl("http://www.sputnick-area.net/smileys.html"))
sys.exit(app.exec_())
答案 0 :(得分:2)
我使用这样的东西:
from PyQt4 import QtGui as qt
from PyQt4 import QtCore as qc
class MainWin(qt.QMainWindow):
def setKeepAbove(self, above):
if above:
self.setWindowFlags(self.windowFlags() | qc.Qt.WindowStaysOnTopHint)
else:
self.setWindowFlags(self.windowFlags() & ~qc.Qt.WindowStaysOnTopHint)