2
簡單的代碼演示問題:QTextEdit.find()不會在Python工作
#!/usr/bin/env python
import sys
from PyQt4.QtCore import QObject, SIGNAL
from PyQt4.QtGui import QApplication, QTextEdit
app = QApplication(sys.argv)
def findText():
print(textEdit.find('A'))
textEdit = QTextEdit()
textEdit.show()
QObject.connect(textEdit, SIGNAL('textChanged()'), findText)
sys.exit(app.exec_())
輸入 'A' 到窗口後,find('A')
仍返回False
。
問題在哪裏?