0

Why is this stacking ontop of each other, as far as the index should get each of them to next row.

data1 = {'PHOTOSHOP': '6.5', 'NUKE': '7.0v9', 'MAYA': '2014', 'TESTING': '1.28', 'KATANA': '1.7', 'MARI': '4.0'} 
data2 = {'PHOTOSHOP': '10.5', 'NUKE': '6.3v6', 'MAYA': '2012', 'TESTING': '1.28', 'KATANA': '1.0', 'MARI': '1.0'}

class MainWindow(QtGui.QWidget):
    """docstring for MainWindow"""
    def __init__(self, dataIn1, dataIn2):
        super(MainWindow, self).__init__()
        self._dataIn1 =  dataIn1
        self._dataIn2 = dataIn2
        x, y, w, h = 500, 200, 300, 400
        self.setGeometry(x, y, w, h)
        self.buildUI()

    def main(self):
        self.show()

    def buildUI(self):
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.setSpacing(10)
        self.combos = []
        for index, (key, values) in enumerate(self._dataIn1.iteritems()):
            label = QtGui.QLabel(key, self)
            combo = QtGui.QComboBox(self)
            combo.addItem(values)
            combo.addItem(self._dataIn2[key])
            # self.combos.append(combo)
            setattr(self, 'combo%d' % index, combo)
            self.gridLayout.addWidget(label, index, 0)
            self.gridLayout.addWidget(combo, index, 2)

def main():
    app = QtGui.QApplication(sys.argv)
    smObj = MainWindow(dataIn1, dataIn2)
    smObj.main()
    app.exec_()

if __name__ == '__main__':
    main()
3
Contributors
3
Replies
21
Views
3 Years
Discussion Span
Last Post by krystosan
-1

Reduce the width and height to minimal size maybe 10 by 10 and see if this still happens, it could just be that the boxs are overlaying because they are running over the eddge of the grid.

Sorry if this doesn't help i'm just starting with GUI in python

0

damn... all this time i was thinking i can only use it with QMainWindow..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.