我正在关注为 开发插件的教程qgis
,但是在尝试在文本框窗口中插入文本时遇到了错误。代码如下所示
类vector_selectbypointdialog.py:
from PyQt4 import QtCore, QtGui
from ui_vector_selectbypoint import Ui_vector_selectbypoint
# create the dialog for zoom to point
class vector_selectbypointDialog(QtGui.QDialog):
def __init__(self):
QtGui.QDialog.__init__(self)
# Set up the user interface from Designer.
self.ui = Ui_vector_selectbypoint()
self.ui.setupUi(self)
def setTextBrowser(self, output):
self.ui.txtFeedback.setText(output)
def clearTextBrowser(self):
self.ui.txtFeedback.clear()
类vector_selectbypoint.py:
在init下创建这样的对象:
# create our GUI dialog
self.dlg = vector_selectbypointDialog()
以及处理插入文本的方法:
handleMouseDown(self, point, button):
self.dlg.clearTextBrowser()
self.dlg.setTextBrowser( str(point.x()) + " , " +str(point.y()) )
错误是:
handleMouseDown self.dlg.clearTextBrowser() AttributeError: 'vector_selectbypointdialog' 对象没有属性 'clearTextBrowser'