Я следую руководству по разработке плагина для 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'