我正在尝试使用PySide Python模块进行GUI开发。我写了这段小代码:
import sys
from PySide.QtCore import *
from PySide.QtGui import *
class Form(QDialog):
def __init__(self, parent=None):
super(Form, self).__init__(parent)
self.lineedit = QLineEdit('test text')
layout = QVBoxLayout()
layout.addWidget(self.lineedit)
self.setLayout(layout)
app = QApplication(sys.argv)
form = Form()
form.show()
app.exec_()
它看起来并不复杂,但在运行代码时它在终端中给我以下消息:
2015-08-10 20:54:33.066 Python[430:f07] unlockFocus called too many time.
2015-08-10 20:54:33.068 Python[430:f07] unlockFocus called too many time.
2015-08-10 20:54:33.560 Python[430:f07] unlockFocus called too many time.
2015-08-10 20:54:33.561 Python[430:f07] unlockFocus called too many time.
2015-08-10 20:54:34.055 Python[430:f07] unlockFocus called too many time.
2015-08-10 20:54:34.055 Python[430:f07] unlockFocus called too many time.
2015-08-10 20:54:34.554 Python[430:f07] unlockFocus called too many time.
2015-08-10 20:54:34.555 Python[430:f07] unlockFocus called too many time.
2015-08-10 20:54:35.055 Python[430:f07] unlockFocus called too many time.
2015-08-10 20:54:35.056 Python[430:f07] unlockFocus called too many time.
2015-08-10 20:54:35.556 Python[430:f07] unlockFocus called too many time.
2015-08-10 20:54:35.557 Python[430:f07] unlockFocus called too many time.
代码运行时,包含此消息的列表越来越长。当我添加一个QPushButton时,Python会在按钮具有焦点时停止抛出错误。将焦点再次更改回QLineEdit时,消息会再次弹出。此外,文本字段(QLineEdit)周围的蓝色笔划/边框正在扩展和扩展,同时显示消息/错误。
我正在使用python 2.7.10和PySide 1.2.2并在Mac OS X 10.7.5上运行
我的代码中是否有问题或与其他内容有关?
编辑:
...对于Mac OS X 10.10.4,消息消失了。 文本字段周围的蓝色笔划/边框在打字时仍在增长/变为深蓝色。请参阅下面的屏幕截图: