7

Is it possible to close the QGIS welcome page with Python?

I have a permanently docked Python plugin, that uses showRubberBand to directly write into map canvas. Therefor I have to close/remove the welcome page first.

9

There are a couple of different approaches to that:

Start a new project

iface.newProject()

Add a layer

Whenever a new layer gets added to the mapcanvas, the welcome page will disappear

Change the configuration

In contrast to the other two approaches, this changes the configuration of the QGIS installation permanently.

# 0: Welcome page
# 1: Most recent
# 2: Specific (specify with '/qgis/projOpenAtLaunchPath')
# 3: New
QSettings().setValue('/qgis/projOpenAtLaunch', 3)
  • Thank's Matthias! if len(QgsMapLayerRegistry.instance().mapLayers()) == 0: self.iface.newProject() does the trick. – christoph Jun 27 '16 at 10:45
  • 1
    I am glad that it helped. Please be so kind and accept the answer as correct (there should be a green tick to click) – Matthias Kuhn Jun 27 '16 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.