python - Convert a .ui into a .py with pyuic? -


i'm using osx 10.8, python 2.7.5

i built gui qtdesigner, , trying figure out how use python. found have use "pyuic" , how here : pyqt installation problem in mac osx snow leopard, following approach given here gave me pretty nice

pyuic: command not found 

any advice welcome on how solve this

i don't know osx, solution use uic module of pyqt4 (pyuic4 wrapper around module). here example of custom qdialog using ui file called mydialog.ui :

import os  pyqt4 import qtgui pyqt4 import uic  class mydialog(qtgui.qdialog):   def __init__(self, parent=none):     qtgui.qdialog.__init__(self, parent)     uic.loadui(os.path.join(os.path.dirname(os.path.abspath(__file__)),"mydialog.ui"), self) 

note loadui method last argument self: means have access widgets attributes of class, ie dialog.textedit instead of dialog.ui.textedit.


Comments