Controlling MXW through Python: Difference between revisions

From MXWendler Wiki
Jump to navigation Jump to search
remove cross-language see-also links (covered by sidebar)
Update links after removing '3.' prefix from reference titles (bot)
Line 1: Line 1:
<!-- MXWendler wiki page: Controlling MXW through Python (overview / hub) -->
<!-- MXWendler wiki page: Controlling MXW through Python (overview / hub) -->
<!-- Intended location: https://wiki.mxwendler.net/index.php?title=1._Controlling_MXW_through_Python -->
<!-- Intended location: https://wiki.mxwendler.net/index.php?title=1._Controlling_MXW_through_Python -->
<!-- See also: https://wiki.mxwendler.net/index.php?title=3._Python_command_reference -->
<!-- See also: https://wiki.mxwendler.net/index.php?title=Python_command_reference -->
<!-- See also: https://wiki.mxwendler.net/index.php?title=3._Python_imgui_reference -->
<!-- See also: https://wiki.mxwendler.net/index.php?title=Python_imgui_reference -->
<!-- See also: https://wiki.mxwendler.net/index.php?title=3._Python_plugin_reference -->
<!-- See also: https://wiki.mxwendler.net/index.php?title=Python_plugin_reference -->


MXWendler StageDesigner embeds '''Python 3.12'''. Python is used in two ways:
MXWendler StageDesigner embeds '''Python 3.12'''. Python is used in two ways:
Line 20: Line 20:
! Topic !! Page
! Topic !! Page
|-
|-
| The <code>mxw</code> command interface &ndash; software info, <code>playlist</code>, <code>io</code>, <code>widget(address)</code>, <code>media(name)</code>, <code>preload(n)</code>, <code>grabber(name)</code> || [[3. Python command reference|Python command reference]]
| The <code>mxw</code> command interface &ndash; software info, <code>playlist</code>, <code>io</code>, <code>widget(address)</code>, <code>media(name)</code>, <code>preload(n)</code>, <code>grabber(name)</code> || [[Python command reference|Python command reference]]
|-
|-
| Drawing plugin settings panels with <code>mxw_imgui</code> (MXWendler's Dear ImGui binding) || [[3. Python imgui reference|Python ImGui reference]]
| Drawing plugin settings panels with <code>mxw_imgui</code> (MXWendler's Dear ImGui binding) || [[Python imgui reference|Python ImGui reference]]
|-
|-
| Writing '''plugins''' &ndash; media and playlist &ndash; the manifest (<code>mxw_plugin.ini</code>), the hooks, per-instance state, examples || [[3. Python plugin reference|Python plugin reference]]
| Writing '''plugins''' &ndash; media and playlist &ndash; the manifest (<code>mxw_plugin.ini</code>), the hooks, per-instance state, examples || [[Python plugin reference|Python plugin reference]]
|}
|}


Line 48: Line 48:
</pre>
</pre>


The host discovers it at startup, shows it in the user interface and calls its hooks at the right moments. See the [[3. Python plugin reference|Python plugin reference]] for the manifest fields, the full hook list for media and playlist plugins, plugin locations, installing extra packages with <code>mxw-pip</code>, and complete examples.
The host discovers it at startup, shows it in the user interface and calls its hooks at the right moments. See the [[Python plugin reference|Python plugin reference]] for the manifest fields, the full hook list for media and playlist plugins, plugin locations, installing extra packages with <code>mxw-pip</code>, and complete examples.


== See also ==
== See also ==


* [[3. Python command reference|Python command reference]] &ndash; the <code>mxw</code> module
* [[Python command reference|Python command reference]] &ndash; the <code>mxw</code> module
* [[3. Python imgui reference|Python ImGui reference]] &ndash; drawing plugin panels with <code>mxw_imgui</code>
* [[Python imgui reference|Python ImGui reference]] &ndash; drawing plugin panels with <code>mxw_imgui</code>
* [[3. Python plugin reference|Python plugin reference]] &ndash; writing media and playlist plugins
* [[Python plugin reference|Python plugin reference]] &ndash; writing media and playlist plugins

Revision as of 17:28, 8 August 2026


MXWendler StageDesigner embeds Python 3.12. Python is used in two ways:

  • Command interface / scripting – the module mxw controls the running software (playlist, layers, clips, media, I/O, widgets by their address, ...) from the script console or from within a plugin.
  • Plugins – self-contained folders that add a media source or a playlist item and are called back by the host through a defined set of functions (hooks).

The presented Python interface is supported in version 7.2. and up

Where to go

The detailed documentation lives on three dedicated pages; this page only points to them so nothing is documented twice.

Topic Page
The mxw command interface – software info, playlist, io, widget(address), media(name), preload(n), grabber(name) Python command reference
Drawing plugin settings panels with mxw_imgui (MXWendler's Dear ImGui binding) Python ImGui reference
Writing plugins – media and playlist – the manifest (mxw_plugin.ini), the hooks, per-instance state, examples Python plugin reference

Quick start

A minimal look at each entry point; follow the links above for the full reference.

Scripting. From the script console (or any hook), the mxw module reaches the software:

import mxw
mxw.print_console("frame " + str(mxw.framecounter))
mxw.playlist.play()
mxw.widget("/mxw/track/active/layer/active/opacity").setValue(0.5)

Plugins. A plugin is a folder holding a manifest and a Python module:

plugins/playlist/python/plugin_my_item/
    mxw_plugin.ini      the manifest: identity, menu entries
    mxw_main.py         the Python module with the hook functions

The host discovers it at startup, shows it in the user interface and calls its hooks at the right moments. See the Python plugin reference for the manifest fields, the full hook list for media and playlist plugins, plugin locations, installing extra packages with mxw-pip, and complete examples.

See also