Hi Bjorn

On Mon, Jan 13, 2014 at 4:28 PM, Bjorn Nyberg
<[email protected]> wrote:
> Hi,
>
> I had a couple of questions that I was hoping could be answered here on the
> mailing list. I am trying to write some code to find the current zoomed in
> rectangular extent of my Map Canvas by the following pyqgis API function
>  QgsMapCanvas.extent()
>
> however I receive the error
>
> TypeError: QgsMapCanvas.extent(): first argument of unbound method must have
> type 'QgsMapCanvas'
>
> Im not entirely certain what that is saying - first argument of unbound
> method?

I suspect that you are literally trying to call
"QgsMapCanvas.extent()" from Python, which is not possible. You need
to use an instance of QgsMapCanvas to call this (or any other) method.
The call you are doing would be possible only if the extent() method
would be a static method of the QgsMapCanvas class. Try this in QGIS
python console:
>>> mc = iface.mapCanvas()
>>> mc.extent()

Martin
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to