我应该如何使用窗口管理器移动使用PySide创建的窗口?
我看到kdeui有一个NETRootInfo带有moveResizeRequest方法的类,它正是我想要的.下列:
from PySide.QtCore import Qt
from PyKDE4 import kdeui
from PySide.QtGui import QX11Info
import sys
from ctypes import CDLL
Xlib = CDLL('libX11.so.6')
def move_window(window, event):
if event.buttons() & Qt.LeftButton:
pos = event.buttonDownScreenPos(Qt.LeftButton)
Xlib.XUngrabPointer(QX11Info.display(), QX11Info.appTime())
rootinfo = kdeui.NETRootInfo(QX11Info.display(), kdeui.NET.WMMoveResize)
rootinfo.moveResizeRequest(window.winId(), pos.x(), pos.y(), kdeui.NET.Move)
Run Code Online (Sandbox Code Playgroud)
给我:
TypeError: NETRootInfo(): arguments did not match any overloaded call:
overload 1: argument 1 has unexpected type 'int'
overload 2: argument 1 has unexpected type 'int'
overload 3: argument 1 has unexpected type …Run Code Online (Sandbox Code Playgroud) 我正在研究PyKDE4/PyQt4应用程序,Autokey,我注意到当我发送程序一个CTRL + C时,键盘中断在我与应用程序交互之前不会被处理.单击菜单项或更改复选框.
lfaraone@stone:~$ /usr/bin/autokey
^C^C^C
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/autokey/ui/popupmenu.py", line 113, in on_triggered
def on_triggered(self):
KeyboardInterrupt
^C^C^C
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/autokey/ui/configwindow.py", line 423, in mousePressEvent
def mousePressEvent(self, event):
KeyboardInterrupt
Run Code Online (Sandbox Code Playgroud)
尽管在/ usr/bin/autokey中有以下内容:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from autokey.autokey import Application
a = Application()
try:
a.main()
except KeyboardInterrupt:
a.shutdown()
sys.exit(0)
Run Code Online (Sandbox Code Playgroud)
为什么没有捕获KeyboardInterrupt:
使用Python 2.6运行Ubuntu 9.04.