[Qgis-developer] Basic question: How to select a layer in the GUI and get the handle in the Python code?

Alexander Bruy alexander.bruy at gmail.com
Wed Dec 7 07:55:01 EST 2011


Hi Ole,

2011/12/7 Ole Nielsen <ole.moller.nielsen at gmail.com>:
> However, I have not yet been able to find an example or a tutorial that
> tells me how to make that selection box pick a layer and give me a handle to
> it in the Python code.
If I understand you correctly, you want to access current selected layer, right?
Use self.iface.mapCanvas().currentLayer() for this

> Also, is there such a thing as a reference manual for the python plugin API?
Python API mainly the same as C++ API, so you can use C++ API from [0]

Also there is PyQGIS Developer Cookbook [1] where you can find some code
examples

[0] http://qgis.org/api
[1] http://www.qgis.org/pyqgis-cookbook/

-- 
Alexander Bruy
NextGIS


More information about the Qgis-developer mailing list