How can I generate python code from a QtDesigner file ? I found pyside-uic but I can't find an example for the syntax. I run win7 and pythonxy with spyder.
pyside-uic is more or less identical to pyuic4, as such the man page specifies:
Usage:
        pyside-uic [options] <ui-file>
Options:
    --version
        show program's version number and exit
    -h,--help
        show this help message and exit
    -oFILE,--output=FILE
        write generated code to FILE instead of stdout
    -x,--execute
        generate extra code to test and display the class
    -d,--debug
        show debug output
    -iN,--ident=N
        set indent width to N spaces, tab if N is 0 (default: 4)
I usually use it like this:
pyside-uic -o output.py input.ui
                        Just tried Pyside's QUILoader, works fine:
from PySide import QtGui  
from PySide import QtCore
from PySide import QtUiTools
class MyWidget(QtGui.QMainWindow):
    def __init__(self, *args):  
       apply(QtGui.QMainWindow.__init__, (self,) + args)
       loader = QtUiTools.QUiLoader()
       file = QtCore.QFile("pyside_ui_qtdesigner_form_test.ui")
       file.open(QtCore.QFile.ReadOnly)
       self.myWidget = loader.load(file, self)
       file.close()
       self.setCentralWidget(self.myWidget)
if __name__ == '__main__':  
   import sys  
   import os
   print("Running in " + os.getcwd() + " .\n")
   app = QtGui.QApplication(sys.argv)  
   win  = MyWidget()  
   win.show()
   app.connect(app, QtCore.SIGNAL("lastWindowClosed()"),
               app, QtCore.SLOT("quit()"))
   app.exec_()
I used Eclipse and QTDesigner to create the .ui file (right-click on module, "New -> Other..", choose "Qt Designer -> Qt Designer Form"). No explicit uic call is needed.
pyside-uic.exe MyWindow.ui -o MyWindow.py 
is what I've been doing and it's working fine (as far as I know)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With