0

当我在终端中运行以下 PyQt 代码示例时:

#coding = utf8
import sys
from PyQt4 import QtGui

app = QtGui.QApplication(sys.argv)
widget = QtGui.QWidget()
widget.resize(250, 150)
widget.setWindowTitle('simple')
widget.show()
sys.exit(app.exec_())

我收到以下消息:

Got bus address:  "unix:abstract=/tmp/dbus-i0C7rhmhFB,guid=6b91faa5b449dbb3ca941d6e0000001d" 
Connected to accessibility bus at:  "unix:abstract=/tmp/dbus-i0C7rhmhFB,guid=6b91faa5b449dbb3ca941d6e0000001d" 
Registered DEC:  true 
Error in contacting registry 
"org.freedesktop.DBus.Error.NoReply" 
"Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken." 
Could not query active accessibility event listeners. 
Registered event listener change listener:  true 

窗口在大约 20 秒后显示。我认为显示一个空窗口应该很快。如何解决这个问题呢?

以下是版本信息:

  • Ubuntu 12.04 LTS 64 位
  • Python 2.7.3rc2
  • QT 4.8.0 和 PyQT 4.9.1
4

1 回答 1

1

在我的机器上,代码立即运行 - Kubuntu 11.10,KDE 4.8.2

我认为问题可能出在您的环境配置中,尤其是在您运行未发布的版本 - Ubuntu 12.04 时。

于 2012-04-09T08:41:47.093 回答