[Link].
tn Programmation d’interface Graphique TP3
Projet graphique N°2 : Calcul du Plus Grand Commun Diviseur
PGCD avec interface graphique Notre mini projet consiste à créer une interface graphique avec l’outil de
création Qt Designer qui permet de saisir deux entiers A et B positifs non nuls et afficher le Plus Grand
Commun Diviseur (PGCD) en utilisant la méthode des différences
Exemples : PGCD (24,18) = PGCD (6,18) = PGCD (6,12) = PGCD (6,6) = 6
PGCD (27,90) = PGCD (27, 63) = PGCD (27, 36) = PGCD (27, 9) = PGCD (18,9) =
PGCD (9,9) = 9
nb1
nb2
effacer
calculer
res
1
[Link] Programmation d’interface Graphique TP3
from [Link] import loadUi
from [Link] import QApplication
def pgcd(a, b):
while not (a == b):
if a > b:
a = a - b
else:
b = b - a
return a
def play():
nb1 = [Link]()
nb2 = [Link]()
if not ([Link]()) or not (int(nb1) > 0):
[Link]('Verifier nb1')
elif not ([Link]()) or not (int(nb2) > 0):
[Link]('Verifier nb2')
else:
nb1 = int(nb1)
nb2 = int(nb2)
s = pgcd(nb1, nb2)
[Link]('PGCD= ' + str(s))
def effacer():
[Link]()
[Link]()
app = QApplication([])
windows = loadUi("[Link]")
[Link]()
[Link](play)
[Link](effacer)
app.exec_()