Python code generation with pyside-uic

前端 未结 8 1164
野的像风
野的像风 2020-12-01 12:18

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.

8条回答
  •  囚心锁ツ
    2020-12-01 13:21

    Read the documentation. In this particular case, http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4ref.html#pyuic4:

    The pyuic4 utility is a command line interface to the uic module. The command has the following syntax:
    
    pyuic4 [options] .ui-file
    
    The full set of command line options is:
    -h, --help  A help message is written to stdout.
    --version   The version number is written to stdout.
    -i N, --indent=N
        The Python code is generated using an indentation of N spaces. If N is 0 then a tab is used. The default is 4.
    -o FILE, --output=FILE
        The Python code generated is written to the file FILE.
    -p, --preview   The GUI is created dynamically and displayed. No Python code is generated.
    -w, --pyqt3-wrapper
        The generated Python code includes a small wrapper that allows the GUI to be used in the same way as it is used in PyQt v3.
    -x, --execute   The generated Python code includes a small amount of additional code that creates and displays the GUI when it is executes as a standalone application.
    --from-imports  Resource modules are imported using from . import rather than a simple import.
    

提交回复
热议问题