Bonjour, je découvre aujourd'hui PyQt4, et je dois dire que la mise en route est bien difficile.

Finalement tout doucement je commence à comprendre, et j'ai besoin de votre expérience pour m'indiquer comment récupérer la valeur d'un QLineEdit "self.entry_1" me permettant ensuite de pouvoir l'entrer dans le QLineEdit "self.entry_2" en cliquant sur le bouton QPushButton "self.bouton_go".

Autre question, doit-on modifier le code ci-dessous ou créer un autre fichier?

Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
# -*- coding: utf-8 -*-
 
# Form implementation generated from reading ui file 'test.ui'
#
# Created: Mon Aug 16 17:51:22 2010
#      by: PyQt4 UI code generator 4.7.4
#
# WARNING! All changes made in this file will be lost!
 
from PyQt4 import QtCore, QtGui
 
class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(400, 300)
        self.frame = QtGui.QFrame(Dialog)
        self.frame.setGeometry(QtCore.QRect(30, 20, 331, 80))
        self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtGui.QFrame.Raised)
        self.frame.setObjectName("frame")
        self.entry_1 = QtGui.QLineEdit(self.frame)
        self.entry_1.setGeometry(QtCore.QRect(120, 10, 113, 20))
        self.entry_1.setObjectName("entry_1")
        self.label_nom = QtGui.QLabel(self.frame)
        self.label_nom.setGeometry(QtCore.QRect(60, 10, 61, 20))
        self.label_nom.setObjectName("label_nom")
        self.entry_2 = QtGui.QLineEdit(self.frame)
        self.entry_2.setGeometry(QtCore.QRect(120, 40, 113, 20))
        self.entry_2.setObjectName("entry_2")
        self.bouton_go = QtGui.QPushButton(self.frame)
        self.bouton_go.setGeometry(QtCore.QRect(250, 10, 75, 23))
        self.bouton_go.setObjectName("bouton_go")
        self.label = QtGui.QLabel(self.frame)
        self.label.setGeometry(QtCore.QRect(70, 40, 46, 13))
        self.label.setObjectName("label")
 
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
 
    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
        self.label_nom.setText(QtGui.QApplication.translate("Dialog", "Votre Nom :", None, QtGui.QApplication.UnicodeUTF8))
        self.bouton_go.setText(QtGui.QApplication.translate("Dialog", "GO!", None, QtGui.QApplication.UnicodeUTF8))
        self.label.setText(QtGui.QApplication.translate("Dialog", "Resultat :", None, QtGui.QApplication.UnicodeUTF8))
 
 
if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    Dialog = QtGui.QDialog()
    ui = Ui_Dialog()
    ui.setupUi(Dialog)
    Dialog.show()
    sys.exit(app.exec_())
Merci par avance,