Graphics Reference
In-Depth Information
>>> execfile(u'/.../tmp1NR24f.py'.encode('utf-8'))
water
urban
basemap
Note that QGIS uses the execfile() function (which is part of the Python standard lib-
rary) to execute your script.
Tip
If your program didn't display the names of any layers, make sure you have a project
loaded with at least one layer. In this example, we've used the example project we created
in the previous chapter, which had three layers in it.
Of course, there is a lot more that we can do with the QGIS Console and its built-in
Python editor, and we'll be using it to do useful work shortly. Before we do, though, there
are two final things you should know about the QGIS Console.
Firstly, the console itself is written in Python using PyQt and the PyQScintilla2 edit-
or. You can learn a lot about how QGIS has been implemented by looking through the
source code to the console, which is available at https://github.com/qgis/QGIS/tree/mas-
ter/python/console .
The second thing you should know is that the console is implemented as a Qt "Dockable"
window; that is, it can be dragged into a pane within the main QGIS window. If you click
and hold the console's title bar, you can drag it inside the main window, as shown in the
following illustration:
Search WWH ::




Custom Search