Designer's "Form -> View in Python ..." outputs Python code in one step

I just installed Qt 5.15.1. In Designer, The menu bar’s Form drop-down list includes a “View in Python …” command. It outputs Python code in one step so it’s not necessary to use uic.LoadUI() or the pyuic5 command. Be nice to describe it in any future versions of the book. I haven’t used Designer enough in the past to know when this command was added.

1 Like

Hey @STEPHEN_E_VAN_DELLEN – nice tip! I’ve never noticed that before, definitely worth mentioning.

Just remember not to edit the generated code, but save it into a file and import it/subclass it to modify it. That ensures you can keep editing the UI in Designer and just export/save over the same file, without having to re-add your other code.

But don’t forget to save the .ui file too! The Designer can’t read the .py file back for further editing. (Should have been obvious but I had to lose a design to learn it.)

1 Like

Very good point, painful lesson to learn but you won’t forget it! :slight_smile: