1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
# -*- coding: utf-8 -*-
#!/usr/bin/python3
import sys
try:
from PyQt5.QtWidgets import QWidget,QMainWindow, QAction, qApp,\
QApplication, QGridLayout, QLabel, QLineEdit, QTextEdit
from PyQt5.QtGui import QIcon
except ImportError:
raise "Erreur lors de l'importation de PyQt5"
class SetupUI(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setupCGToolBar()
title = QLabel('Title')
author = QLabel('Author')
review = QLabel('Review')
titleEdit = QLineEdit()
authorEdit = QLineEdit()
reviewEdit = QTextEdit()
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(title, 1, 0)
grid.addWidget(titleEdit, 1, 1)
grid.addWidget(author, 2, 0)
grid.addWidget(authorEdit, 2, 1)
grid.addWidget(review, 3, 0)
grid.addWidget(reviewEdit, 3, 1, 5, 1)
self.setLayout(grid)
self.setGeometry(300, 300, 300, 220)
self.setWindowTitle("Formulaire ICF")
self.show()
# ToolBar
def setupCGToolBar(self):
self.cg = self.addToolBar('CG')
self.cg.addAction('Conditions générales d\'utilisations')
def showCG(self):
QMessageBox.question(self, 'Message', 'Show my message', QMessageBox.Yes)
# /Toolbar
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = SetupUI()
sys.exit(app.exec_()) |
Partager