8

QGIS 3.10; Ubuntu 18.04

When Plugins->PythonConsole is accessed, it opens as a panel, changing the shape of the map canvas.

Can it be a separate window instead?

Alternatively, is there a way to run a python command; e.g., size() and resize(), without having to open the console?

1 Answer 1

8

You can show a new window using the following

from console.console import PythonConsoleWidget

consoleWidget = PythonConsoleWidget()
consoleWidget.show()

You could hide with startup.py original Python console in the menus and instead use this separated window. Be careful as my code does do manage the console as a singleton like the show_console used by default https://github.com/qgis/QGIS/blob/master/python/console/console.py#L42 (and use a QDockWidget)

Alternatively, is there a way to run a python command; e.g., size() and resize(), without having to open the console?

Normally, using again startup.py you could (see https://docs.qgis.org/3.10/en/docs/pyqgis_developer_cookbook/intro.html#the-startup-py-file) considering you will not need to use it after QGIS startup.

1
  • Perfection, thank you.
    – quagmire
    Jun 27, 2020 at 18:40

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.