问题
I designed a customized UI in Photoshop and now I would like to use XML to create and GUI for python. I saw this website http://wiki.xbmc.org/index.php?title=WindowXML and they use WindowXML GUI Toolkit to create customized GUI.
Has someone achieved this? where can I get more info?
I have heard of Qt and wxPython but All the examples I have found can be easily achieved with Tkinter.
Please answer this question with some examples and(or) details. I know that many python (newbie) programmers are looking for something like this.
回答1:
I think glade outputs the GUI construction as an XML file which can then be translated into Python (or other languages). You can use the Glade constructor directly to design the GUI but since you've already done it using Photoshop, you can try to write the layout in the same schema that glade outputs. Once you do that, the glade toolchain should be able to convert it into Python for you.
回答2:
Not XML, but QT supports QML, which is a concise Javascript based way of doing some declarative layouts of GUIs:
Item {
Rectangle {
id: myRect
width: 100
height: 100
}
Rectangle {
width: myRect.width
height: 200
}
}
Here's a QML tutorial using PySide (a QT library for Python).
来源:https://stackoverflow.com/questions/11702071/how-do-i-generate-a-python-gui-using-an-xml-based-layout-of-the-gui