AmesimKnowledge

The App Designer in detail > The App Designer Quick-Start Wizard

Template python and ui files

The App Designer - Quick Start wizard generates several python and ui files based on the selected app template and main form settings.

It is important to understand their role when editing Python code so as to not break your app.

The mainform.ui file is edited by means of a visual UI editor. The widget open for editing in the Ui editor is the main widget of the app.

  • The objectName is the Form Name in the Quick Start dialog:

  • The class type is the type selected in the Templates list of the Quick Start dialog:

  • The widget title is the Window title in the Quick Start dialog:

  • The Initial size is the one selected in the Size combo-box in the Quick Start dialog:

The ui_mainform.py is a Python file with content generated based on your edits of the mainform.ui file. This code generation happens automatically when saving the mainform.ui file.

The ui_mainform.py file can only be viewed in read-only mode. You may not modify the content of this file manually, in an external editor. Its content is recreated at every save of the associated mainform.ui file.

The mainform.py file contains the method that is executed by the Simcenter Amesim apps framework to start the app:

The apps framework knows the runApp method is located in this python file, because the file is marked as the main python file:

Note

If you move this method to another python file, you will have to manually mark that file as main. This can be done from the file context menu, as visible in the screenshot above.

In addition, the mainform.py file contains the definition of the main widget of the app:

  • The class name is the Form Name in the Quick Start dialog:

  • The class type is the type selected in the Templates list of the Quick Start dialog:

The MainForm class defined here inherits the Ui_MainForm class generated in the ui_mainform.py file when you save the mainform.ui file. All the widgets defined in the Ui visual editor, are loaded into the MainForm class instance during the Ui_MainForm.setupUi() call: self.setupUi(self)

The MainForm class also installs all the associations defined in the Ui visual editor: self.doAutoAssociations(self)

These calls are part of the class initialization method:

You may add your own initialization declarations to the init method.

Your code can be added inside the markers or outside. Adding your python code inside the markers is not compulsory. However, doing so might help an automated app code upgrade mechanism to know where the user code is located, and streamline the app upgrade process in the future when changes to the Simcenter Amesim app Framework will be made and existing apps need to be upgraded.

Removing the methods setupUi and doAutoAssociations together with the mainform.ui is possible.

You must have a python file with the runApp method, marked as the "main" python file, for Simcenter Amesim to be able to launch the app.

Note

If you are not ready to use Python coding you can simply ignore the Python files for now and leave them as they are. In this case, your main working area will be the mainform.ui file.

Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.App_Designer/xid1018016 · retrieved 2026-07-17