I'm glad that you got it working.

About that warning at the top of the Ui_Form file: you really should consider putting your custom code in the file containing your MyForm class. If, in the future, you decide to make changes to your form you will have to re-key (or copy from backup) your custom code into the new file generated by pyuic4. All you have to do to access the widgets on the form is preface the widget name with “ui.”.

Something like this:
Qt Code:
  1. #!/usr/bin/python -d
  2. # -*- coding: utf-8 -*-
  3.  
  4. import sys
  5. from PyQt4 import QtCore, QtGui
  6. from table8 import Ui_Form
  7.  
  8. # Lars set this path to where you have my scripts!
  9. sys.path += ['/jobs/generic/shots/lightDome/qtDesigner']
  10.  
  11. class MyForm(QtGui.QMainWindow):
  12. def __init__(self, parent=None):
  13. QtGui.QWidget.__init__(self, parent)
  14. self.ui = Ui_Form()
  15. self.ui.setupUi(self)
  16. QtCore.QObject.connect(self.ui.spinBox, QtCore.SIGNAL("valueChanged(int)"), self.createMyRow)
  17. def createMyRow(self, rows):
  18. howManyRows = self.ui.tableWidget.rowCount()
  19. diff = rows - howManyRows
  20. if diff > 0:
  21. start = howManyRows
  22. while rows > start:
  23. print(start)
  24. self.ui.tableWidget.insertRow(start)
  25. self.comboBoxNew = QtGui.QComboBox()
  26. self.comboBoxNew.setGeometry(QtCore.QRect(30, 480, 61, 21))
  27. self.comboBoxNew.setMaxVisibleItems(2)
  28. self.comboBoxNew.setMaxCount(2)
  29. self.comboBoxNew.setObjectName("comboBox")
  30. self.comboBoxNew.addItem("")
  31. self.comboBoxNew.addItem("")
  32. self.comboBoxNew.setItemText(0, QtGui.QApplication.translate("Form", "color", None, QtGui.QApplication.UnicodeUTF8))
  33. self.comboBoxNew.setItemText(1, QtGui.QApplication.translate("Form", "bw", None, QtGui.QApplication.UnicodeUTF8))
  34. self.ui.tableWidget.setCellWidget(start,1,self.comboBoxNew)
  35. start = start +1
  36.  
  37. if __name__ == "__main__":
  38. app = QtGui.QApplication(sys.argv)
  39. myapp = MyForm()
  40. myapp.show()
  41. sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode