0

I follow this tuto (https://python.antoinepernot.fr/cours.php?course=chap10) but i don't know why i have this error when i run it :

Starting Python ...
Traceback (most recent call last):
  File "vss.py", line 4, in <module>
    class Dialog(QtGui.QDialog):
AttributeError: 'module' object has no attribute 'QDialog'

here is the code :

# -*- coding: utf-8 -*-

import sys
from PySide2 import QtCore, QtGui

class Dialog(QtGui.QDialog):#----<----<-----<-----<----error here
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self,parent)
        # Les champs
        self.__champTexteNomAuteur = QtGui.QLineEdit("")
        self.__champTextePrenomAuteur = QtGui.QLineEdit("")
        self.__champDateNaissanceAuteur = QtGui.QDateEdit()
        self.__champDateNaissanceAuteur.setCalendarPopup(True)
        self.__champTexteTitreLivre = QtGui.QLineEdit("")
        self.__champDatePublication = QtGui.QDateEdit()
        self.__champDatePublication.setCalendarPopup(True)
        # Les widgets
        self.__widgetAuteur = QtGui.QWidget()
        self.__widgetLivre = QtGui.QWidget()
        # Les layouts des onglets
        self.__layoutAuteur = QtGui.QFormLayout()
        self.__layoutAuteur.addRow("Nom : ", self.__champTexteNomAuteur)
        self.__layoutAuteur.addRow("Prénom : ", self.__champTextePrenomAuteur)
        self.__layoutAuteur.addRow("Date de naissance : ", self.__champDateNaissanceAuteur)
        self.__widgetAuteur.setLayout(self.__layoutAuteur)
        self.__layoutLivre = QtGui.QFormLayout()
        self.__layoutLivre.addRow("Titre : ", self.__champTexteTitreLivre)
        self.__layoutLivre.addRow("Date de publication : ", self.__champDatePublication)
        self.__widgetLivre.setLayout(self.__layoutLivre)
        # La boîte à onglets
        self.__tabWidget = QtGui.QTabWidget()
        self.__tabWidget.addTab(self.__widgetAuteur, "Auteur")
        self.__tabWidget.addTab(self.__widgetLivre, "Livre")
        # Le layout final
        self.__mainLayout = QtGui.QVBoxLayout()
        self.__mainLayout.addWidget(self.__tabWidget)
        self.setLayout(self.__mainLayout)
app = QtGui.QApplication(sys.argv)
dialog = Dialog()
dialog.exec_()

QDialog isn't in QtGui anymore or something ?

PySide2 version : 2.0.0~alpha0

Thanks for help !

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
PAYRE Quentin
  • 341
  • 1
  • 12

0 Answers0