Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from PyQt4 import QtGui, QtCore
- class Example(QtGui.QWidget):
- def __init__(self):
- super(Example, self).__init__()
- self.initUI()
- def initUI(self):
- ov_main = QtGui.QHBoxLayout()
- ov_col1 = QtGui.QFormLayout()
- ov_col2 = QtGui.QVBoxLayout()
- ov_custs = QtGui.QFormLayout()
- grid = QtGui.QGridLayout()
- overviewBox = QtGui.QGroupBox('Overview')
- # Main window
- grid.addWidget(QtGui.QLabel('Part Number'), 1, 1)
- grid.addWidget(QtGui.QLineEdit(), 1, 2)
- grid.addWidget(overviewBox, 2, 1, 1, 2)
- # overview box
- labels = ['Description:', 'Sales:', 'Sales:', 'Shipped:']
- self.overview_data = []
- for i, label in enumerate(labels):
- lbl = QtGui.QLabel('- blank -')
- lbl.setText(' - blank - ')
- self.overview_data.append(lbl)
- ov_col1.addRow(label, lbl)
- # top 5 frame
- rows = ['<u>Top 5 Customers (by quantity shipped)</u>'] + ['' for i in range(5)]
- self.topFive = []
- for item in rows:
- print("Item")
- if not item == '':
- ov_col2.addWidget(QtGui.QLabel(item))
- else:
- cust = QtGui.QLabel(' - Customer - ')
- qty = QtGui.QLabel('1234')
- self.topFive.append([cust, qty])
- ov_custs.addRow(cust, qty)
- ov_col1.setLabelAlignment(QtCore.Qt.AlignRight)
- ov_custs.setFormAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignRight)
- ov_main.addLayout(ov_col1)
- ov_main.addLayout(ov_col2)
- ov_col2.addLayout(ov_custs)
- self.setLayout(grid)
- overviewBox.setLayout(ov_main)
- self.move(300, 150)
- self.setWindowTitle('OPW Sales Analyzer')
- name = 'a'
- val = 1
- for cust,qty in self.topFive:
- cust.setText(name)
- qty.setText(str(val))
- name = name * 2
- val = val * 10
- self.show()
- def main():
- app = QtGui.QApplication(sys.argv)
- ex = Example()
- sys.exit(app.exec_())
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement