AttributeError:'bool'对象没有属性'addRasterLayer'

时间:2019-10-24 08:32:33

标签: pyqt5 qgis

以下是我的代码:

def browseR(self, iface):
    self.iface = iface 
    filename, filter_string = QFileDialog.getOpenFileName(None, "Open RED Band", "", "GeoTIFF(*.tif)")
    if filename is not None:
        self.iface.addRasterLayer(filename, str.split(os.path.basename(filename), ".") [0])

0 个答案:

没有答案