Qt Designer doesn't work for Python code preview

The error happens as follows:
Create “NewExtension” with Extension Wizard
Add Module to Extension “NewModule”
Go to Modules combobox, go to Examples->NewModule
Go to Edit UI (Qt Designer opens)
Go to Form->View Python Code…

It gives the following error:

What Slicer version and operating system do you use? Have you built Slicer yourself?

Slicer version is 4.11.20200930 and Windows version is Windows 10 Pro x64.
I haven’t built Slicer myself because I wasn’t able to get the dependencies going. This is the installer version

Can you check if it works in the latest Slicer Preview Release? (there were some fixes related to this)

The Preview Release still has a few major issues, but you may just use its Qt Designer.

Yes, Andras. I have checked and it doesn’t work on the Preview Release.
Also if you select Form->View C++ Code… it shows the same error.

I’ve just realized that you are trying to generate some Python code. This is not needed! In Slicer, we developed a much simpler method for using .ui files in Python directly, using slicer.util.loadUI and slicer.util.childWidgetVariables functions, as it is shown in the module template.

You get the error because Python code generation requires the uic compiler, which we don’t bundle with Slicer, as it should not be necessary.

Thank you Andras for clarifing the matter. I wanted to review the code because I wanted to make a coded UI but no problem, I’ll stick to .ui desing in Qt Designer.
Is there a tutorial to create a script with .ui GUI? because I don’t know what to write in some methods that are automatically created and this tutorial I’m using creates the UI through code and looks much simpler

Using the designer reduces the size of a scripted module by 20-30%. Having less code means less code to debug and maintain. Using a visual designer also allows the developer on nicer, more intuitive GUI, while generating from code tends to result in GUI that the developer can create more easily, but it is worse for the users. I would recommend this developer tutorial.

Thank you Andras. I checked it out a little bit but I’ll read it more carefully when I have a little more time. Until now I was only using this to check out classes definitions and this for some code examples. Now I have another resourse :smiley: