Difference between revisions of "QGIS Python Extensions"

From OSGeo
Jump to navigation Jump to search
Line 1: Line 1:
writing a python plugin for qgis
+
The idea for this session was to try to write a QGIS plugin in Python.
 +
 
 +
Since no one present had actually attempted this before, we ended up talking a bit about working with Python and then looked at the sample framework.
  
 
http://qgis.org/pyqgis-cookbook/plugins.html
 
http://qgis.org/pyqgis-cookbook/plugins.html
  
uses qt for form editing (qt form designer)
+
== Things to know ==
 +
 
 +
QGIS is a GIS program written on the QT GUI framework, so Python plugins are built using PyQT.
 +
After you have decided what your plugin is going to do, lay out the user interface in "QT 4 Designer".
 +
Using the sample framework as a template, connect the controls in your UI to your python code.
 +
 
 +
The entire QT SDK for programmers is available for free. If you are an Ubuntu user, install the packages 'qt4-designer' and 'python-qt4'
 +
 
 +
The sample we looked at was a trivial "Hello World" thing. (Clicking the "run" button puts text into the QGIS console.)
 +
There are other samples available, but we only had an hour. We vowed to do a more complete session at an upcoming PDX GEO meeting.
 +
 
 +
== Working with Python ==
 +
 
 +
You really will want an advanced editor / IDE for python. It makes things a lot easier.
 +
 
 +
One mentioned in the section was '''pyscripter''' - intellisense for coding (windows only?)
 +
 
 +
Another one that's really nice is Komodo from ActiveState. It runs on all platforms. There are both commercial and free versions.
 +
Komodo also supports other languages like PHP and Perl. The commercial version supports debugging, including debugging on remote platforms.
 +
 
 +
If you are already a Java programmer you probably use Eclipse and there is a Python plugin for it. Eclipse is free.
 +
 
  
pyscripter - intellisense for coding (windows only?)
 
  
 
Return to [ http://wiki.osgeo.org/wiki/PDX-OSGEO#Unconference_Sessions 2011 Unconference Sessions].
 
Return to [ http://wiki.osgeo.org/wiki/PDX-OSGEO#Unconference_Sessions 2011 Unconference Sessions].

Revision as of 11:58, 2 April 2011

The idea for this session was to try to write a QGIS plugin in Python.

Since no one present had actually attempted this before, we ended up talking a bit about working with Python and then looked at the sample framework.

http://qgis.org/pyqgis-cookbook/plugins.html

Things to know

QGIS is a GIS program written on the QT GUI framework, so Python plugins are built using PyQT. After you have decided what your plugin is going to do, lay out the user interface in "QT 4 Designer". Using the sample framework as a template, connect the controls in your UI to your python code.

The entire QT SDK for programmers is available for free. If you are an Ubuntu user, install the packages 'qt4-designer' and 'python-qt4'

The sample we looked at was a trivial "Hello World" thing. (Clicking the "run" button puts text into the QGIS console.) There are other samples available, but we only had an hour. We vowed to do a more complete session at an upcoming PDX GEO meeting.

Working with Python

You really will want an advanced editor / IDE for python. It makes things a lot easier.

One mentioned in the section was pyscripter - intellisense for coding (windows only?)

Another one that's really nice is Komodo from ActiveState. It runs on all platforms. There are both commercial and free versions. Komodo also supports other languages like PHP and Perl. The commercial version supports debugging, including debugging on remote platforms.

If you are already a Java programmer you probably use Eclipse and there is a Python plugin for it. Eclipse is free.


Return to [ http://wiki.osgeo.org/wiki/PDX-OSGEO#Unconference_Sessions 2011 Unconference Sessions].