When I tried to open text file in text browser I got this error
def cari(self, event=None):
#open dialog
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open File', '*.xml')
if filename:
self.ui.lineFile.delete(0, END)
self.ui.lineFile.insert(END, filename)
#call isi data
self.isiDataFile(filename)
def isiDataFile(self, nmfile):
#open with read mode
teksFile = open(nmfile, 'r').read()
self.ui.textFile.delete('1.0', END)
self.ui.textFile.insert('1.0', teksFile)
Error:
Traceback (most recent call last):
File "C:\Users\Mr.Pakde/.qgis2/python/plugins\latih\latihdialog.py", line 44, in cari
self.ui.lineFile.delete(0, END)
'QLineEdit' object has no attribute 'delete'
Can someone help me?
If you see the docs,
QLineEdit
(self.ui.lineFile
in your code) doesn't havedelete
method, but has adel_
method and abackspace
method. You might want to use one of these.