How do I generate a python GUI using an XML based layout of the GUI?

半城伤御伤魂 提交于 2019-12-11 04:42:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!