QGIS not interacting with iface from python class

المشرف العام

Administrator
طاقم الإدارة
So I'm working on something where i need to use threads from python console of QGIS.The following line of code adds layer successfully

iface.addVectorLayer("D:\ArcGIS Misc\Atlas\points.shp", 'Points', 'ogr')But when i try to run the following code:

from threading import Threadclass AddLayer(Thread): def __init__(self, iface): Thread.__init__(self) self.iface = iface def run(self): self.iface.addVectorLayer("D:\ArcGIS Misc\Atlas\points.shp", 'Points', 'ogr') print 'added'AddLayer(iface).start()then i only get added printed on the console but the layer is never added. When i do it from a class which is not inherited from Thread then it works fine. Help Needed



أكثر...
 
أعلى