Qt/PyQt doesn't come with a tool for that, and AFAIK nobody's written one.
And it's hard to imagine why you'd need it. Just keep the .ui file around, and never edit the generated .py file (or even use the .ui file dynamically at runtime with uic
), and you'll never need to reverse-convert.
Meanwhile, if you've got some random PyQt4 code that generates a GUI that wasn't even created by pyuic4
, there's no guarantee that any .ui
could possibly generate the code. (In fact, most of the PyQt samples you'll find online don't do things the same way pyuic4
would, and most likely any other code generator will similarly not do things the same way pyuic4
does.)