# Execute a macro or python script from C code in a ParaView-based application

**URL:** https://discourse.paraview.org/t/execute-a-macro-or-python-script-from-c-code-in-a-paraview-based-application/3568
**Category:** Development
**Created:** [February 14, 2020, 2:41pm UTC](https://discourse.paraview.org/t/execute-a-macro-or-python-script-from-c-code-in-a-paraview-based-application/3568 "2020-02-14T14:41:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![majo\_vlas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/majo_vlas/32/2567_2.png) [@majo\_vlas](https://discourse.paraview.org/u/majo_vlas)
#### Post date: [February 14, 2020, 2:41pm UTC](https://discourse.paraview.org/t/execute-a-macro-or-python-script-from-c-code-in-a-paraview-based-application/3568/1 "2020-02-14T14:41:39Z")

</div>

I’m building a ParaView-based application, starting from `Clone1` code  
[https://gitlab.kitware.com/paraview/paraview/tree/master/Examples/CustomApplications](https://gitlab.kitware.com/paraview/paraview/tree/master/Examples/CustomApplications).

I want to know how to connect the UI components I add in QtDesigner with the ParaView framework.

More specifically, how to execute a macro when checking a checkbox.

If I look at Paraview source code, it seems to deal with macros in `paraview-master/Qt/Python/pqPythonMacroSupervisor.cxx`

```auto
void pqPythonMacroSupervisor::onMacroTriggered()
{
  QObject* action = this->sender();
  QMap<QString, QAction*>::const_iterator itr = this->Internal->RunActionMap.constBegin();
  for (; itr != this->Internal->RunActionMap.constEnd(); ++itr)
  {
    if (itr.value() == action)
    {
      QString filename = itr.key();
      emit this->executeScriptRequested(filename);
    }
  }
}

```

So, what do I need to add to `myMainWindos.cxx` to execute a macro or python script when an action is triggered?
