Few questions Xml / Py via UI. I got both to work. however the examples only show the use of PyQt Implementation with Xml
from PyQt4 import uic
#If you put the .ui file for this example elsewhere, just change this path.
listExample_form, listExample_base = uic.loadUiType(‘c:/Users/Ken/Desktop/example1.ui’)
class ListExample(listExample_form, listExample_base):
def init(self, parent=getMayaWindow()):
super(ListExample, self).init(parent)
self.setupUi(self)
#The names "addItemBtn" and "removeItemBtn"
#come from the "objectName" attribute in Qt Designer
#the attributes to access them are automatically created
#for us when we call setupUi()
#Designer ensures that the names are unique for us.
self.addItemBtn.clicked.connect(self.addItem)
self.removeItemBtn.clicked.connect(self.removeItem)
def addItem(self):
"""
Add a new item to the end of the listWidget
"""
item = QtGui.QListWidgetItem(self.listWidget)
item.setText('Item #%s!'%self.listWidget.count())
def removeItem(self):
"""
Remove the last item from the listWidget
"""
count = self.listWidget.count()
if count:
self.listWidget.takeItem(count-1)
ListExample().show()
In addition I was wondering I tried to simply replace the ( loadUiType c:/Users/Ken/Desktop/calcWidget2.ui )
from PyQt4 import uic
#If you put the .ui file for this example elsewhere, just change this path.
listExample_forma, listExample_basea = uic.loadUiType(‘c:/Users/Ken/Desktop/calcWidget2.ui’)
class ListExamplea(listExample_forma, listExample_basea):
def init(self, parent=getMayaWindow()):
super(ListExamplea, self).init(parent)
ListExamplea().show()
and The UI attaches to Maya (doesn’t create a separate window/doesn’t show at all) was wondering what would cause it to break.
Sorry If these Questions are super simple (Still learning PyQt/programming in general)