Skip to content

Using the Python Scripting Interface

MP Software (Keller Hydle) edited this page Sep 24, 2024 · 4 revisions

Using the Python Scripting Interface

MPRUN provides a powerful Python Scripting Interface (PSI) to interact with its internal application functions.

Warning

Having a good understanding of the Python programming language is essential if you want to really take advantage of the PSI. It’s okay if you don’t know Python though, as you can still download other people’s Python scripts.

Part 1: Types

You can access MPRUN’s types and objects simply by inputting mprun and using the access modifier .

All GUI is written in PyQt, so a knowledge of the Qt framework can really help cr

MPRUN has types for accessing GUI widgets and functions, here is a full list:

  • mprun.panel_container: the right QToolBox containing all panels (properties panel, libraries panel, etc.)
  • mprun.toolbar: the left QToolBar containing all tool button QActions (select tool, pan tool, etc.)
  • mprun.edit_toolbar the top QToolBar containing edit button QActions (align tools, layer tools, etc.)
  • mprun.menu_bar: the QMenuBar containing all sub menus (file, tools, etc.

Part 2: Using the Types

After you have seen all types, you can start using them. Let’s create an example script:

# No need to import mprun, as it is executed at run time

my_widget = QPushButton(mprun, ‘This is a test’)
mprun.toolbar.addWidget(my_widget)

This will create a button on the left toolbar that says “This is a test”

Part 3: Coming Soon

Clone this wiki locally