PyQt4:如何使带有保留空间的下corcord窗口 [英] PyQt4: how to make undercorated window with reserved space
问题描述
我想使用用于Linux的PyQt4创建一个类似于面板的应用程序.为此,我需要创建的窗口:
I'd like to make a panel-like application using PyQt4 for Linux. for this i need the window i created:
- 没有装饰
- 保留空间
- 出现在所有工作区中
通过阅读文档我已经有了我应该使用QtWindowFlags的想法.但是我不知道如何做到这一点.我也相信应该在某处告诉QM.WindowType提示WM窗口是一个停靠"应用程序.我已经在此线程中使用pygtk做到了这一点,但是在Qt中我不这样做真的知道如何处理. (我需要Qt才能更轻松地进行主题/皮肤应用程序.)
From reading the documentation i've got the idea that i should use QtWindowFlags. But i have no clue as to how to do that. Also i believe there should be a Qt.WindowType hint somewhere telling the WM the window's a "dock" application. I have made this with pygtk following this thread, but here with Qt i don't really know how to handle this. (I need Qt for its ability to theme/skin application more easily.)
下面是我编写的当前代码(没什么特别的).
Below is the current code i made (nothing extraordinary).
import sys
from PyQt4 import QtGui
class Panel(QtGui.QWidget):
def __init__(self, parent=None): ## should the QtWindowFlag be here?
QtGui.QWidget.__init__(self, parent) ## should the QtWindowFlag be there as well?
self.setWindowTitle('QtPanel')
self.resize(QtGui.QDesktopWidget().screenGeometry().width(), 25)
self.move(0,0)
def main():
app = QtGui.QApplication(sys.argv)
panel = Panel()
panel.show()
sys.exit(app.exec_())
return 0
if __name__ == '__main__':
main()
有人可以帮我吗?谢谢:)
Can anyone help me with this? Thanks :)
推荐答案
The solution is to use Python-Xlib, and it has been described in an answer on a universal way to reserve screen space on X.
这篇关于PyQt4:如何使带有保留空间的下corcord窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!