[Qgis-user] Plugin QGIS Error "QTextEdit.setPlainText(QString): not enough arguments"

Jorge Tornero jtorlistas at gmail.com
Wed Jan 1 05:25:00 PST 2014


As a quick answer: you're setting the tex(not getting)t in

 f.write( 'Rekomendasi :' + str(self.ui.textRec1.setPlainText()) )

It should be something like

 f.write( 'Rekomendasi :' + str(self.ui.textRec1.text()) )

(I guess that self.ui.textRec1 is a QLineEdit, of course)

Happy New Year!!


Jorge Tornero



2014/1/1 Suryo Miles <suryomiles666 at gmail.com>

> I try to make save as button but i got this error message when try to save
> file in my directory
>
>     File
> "C:\Users\Mr.Pakde/.qgis2/python/plugins\condition\conditiondialog.py",
> line 80, in saveAs
>         self._save( _filename )
>     File
> "C:\Users\Mr.Pakde/.qgis2/python/plugins\condition\conditiondialog.py",
> line 68, in _save
>         f.write( 'Rekomendasi :' + str(self.ui.textRec1.setPlainText() ) )
>     TypeError: QTextEdit.setPlainText(QString): not enough arguments
>
> this is my code
>
>     Smpan = self.ui.btnSave
>             QtCore.QObject.connect(Smpan,
> QtCore.SIGNAL('clicked()'),self.saveAs)
>
>         def Compare1(self):
>             input1 = self.ui.lineInput1.text()
>             input2 = self.ui.lineInput2.text()
>             compare = ''
>             if input1 == input2:
>                 compare = 'Data dapat digunakam'
>             else:
>                 compare = 'Data tidak cocok'
>             self.ui.textRec1.setPlainText(compare)
>
>         def _save(self, simpan):
>             f = open( simpan, 'w' )
>             f.write( 'Input 1 :' + str(self.ui.lineInput1.text()) )
>             f.write( 'Input 2 :' + str(self.ui.lineInput2.text()) )
>             f.write( 'Rekomendasi :' +
> str(self.ui.textRec1.setPlainText()) )
>             f.close()
>         def savefile(self):
>             if self.simpan:
>                   self._save( "%s" % self.simpan )
>             else:
>                   self.saveAs()
>
>         def saveAs(self):
>                 tulis = QtGui.QFileDialog(self).getSaveFileName()
>                 if tulis !="":
>                     _filename = "%s" % tulis
>                     self._save( _filename )
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20140101/b9a99107/attachment.html>


More information about the Qgis-user mailing list