Skip to content
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (42 sloc) 2.06 KB

QGIS Command Bar

Buy Nathan a drink because he makes cool stuff. )

Adds a simple interactive command bar to QGIS. Commands are defined as Python code and may take arguments.

All functions are interactive and if not all arguments are given will prompt for each one as required.

When defining a interactive functions questions can be added using the command.command decorator

@command.command("Question 1", "Question 2")
def my_function(arg1, arg2):

The new function can be called in the command bar like so:

my-function Hello World

The command bar will split based on space and the first argument is always the function name, the rest are arguments passed to the function.

The command bar also has auto complete for defined functions, and tooltips once I get that to work correctly

You can use CTRL + ; to open and close the command bar.


You can also alias a function by calling the alias function in the command bar.

alias mypoint point-at 100

point-at is a built in function that creates a point at x y however we can alias it so that it will be pre-called with the x argument set. Now when we call mypoint we only have to pass the y each time.

-> mypoint
(point-at) What is the Y?: 200

Pro Tip:

You can even alias the alias command

-> alias & alias
& mypoint 100

& is now the shortcut hand for alias

User functions

In a future version I will load user functions from a .qgis2/python/qgiscommand folder. Open to pull requests for that feature.


This is a work in progress and mainly a quick brain dump to play around with the idea.


  • Save alias comamnds to disk
  • User function location
  • Tests
  • More tests
  • Docs
  • More functions

Open to pull requests

You can’t perform that action at this time.