4 - Première Fenêtre PyQt5 Python - Approche Objet

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024
  • Source code: www.tresfacile...
    Créer une fenêtre PyQt5 ou PyQt6 selon l'approche objet Python est une opération légèrement différente de celle que nous avons déjà vue: créer une première fenêtre pyqt5 ou pyqt6, on doit préalablement importer depuis le module QtWidgets les classes nécessaires: QApplication, QWidget, QLabel, QPushButton, QLineEdit, QMenuBar...
    On crée ensuite une classe Python nommée MYWindow qui hérite de la classe QWidget. On crée ensuite le constructeur de la classe au sein duquel on insère la commande super.__init__ afin d'hériter toute les propriétés et méthodes de la classe mère.
    On doit ensuite créer une instance objet sur la classe QApplication puis on crée une première fenêtre à l'aide d'une instanciation sur la classe QWidget et on applique ensuite la méthode .show pour visualiser la fenêtre PyQt5. Ce tutoriel PyQt Python a été réalisé à l'aide de la version Python 3.6 Windows 10 , Python 3.7 Windows 10, Python 3.8 Windows 10 et Python 3.9 Windows 10, et cela a présenté des bug avec Python 3.10 Windows 10. L'IDE utilisé est Wig 7. Pour un visionnage de qualité, utiliser le navigateur google chrome.
    Creating a PyQt5 or PyQt6 window according to the Python object approach is a slightly different operation from the one we have already seen: creating a first pyqt5 or pyqt6 window, we must first import from the QtWidgets module the necessary classes: QApplication, QWidget, QLabel , QPushButton, QLineEdit, QMenuBar ...
    We then create a Python class named MYWindow which inherits from the QWidget class. We then create the constructor of the class in which we insert the super .__ init__ command in order to inherit all the properties and methods of the parent class.
    We must then create an object instance on the QApplication class then we create a first window using an instantiation on the QWidget class and we then apply the .show method to view the PyQt5 window. This PyQt Python tutorial was made using Python 3.6 Windows 10, Python 3.7 Windows 10, Python 3.8 Windows 10, and Python 3.9 Windows 10, and this showed bugs with Python 3.10 Windows 10. The IDE used is Wig 7. For quality viewing, use the google chrome browser.
    Ce tutoriel python a été réalisé avec l'IDE Python Wing Python 3.7 - Windows 10 et a été testé sur les autres version de python: Python 3.8 - Windows 10 et Python 3.9 - Windows 10. Pour un visionnage de qualité, utiliser le navigateur google chrome.
    Tutoriel Python: • Premier Programme avec...
    Liste des cours Python sur très facile FR: www.tresfacile...
    Python Courses on my-courses.net EN: www.my-courses...
    Python Exercises on my-courses.net EN: www.my-courses...
    Exercices Python avec Solutions
    - Exercices sur les les listes & chaines de caractères Python: • Message De Bienvenue E...
    - Exercices sur les fichiers Python: • Déterminer l'extension...
    - Exercices sur les classes & programmation orientée objet POO Python: • Exercice Python Clas...
    - Exercices sur les interfaces graphiques Python GUI Tkinter: • Exercice Python, Appli...
    - Exercices sur les dictionnaires Python: • Exercice Python: Dicti...
    - TP & TD Python avec solutions: www.tresfacile...
    Python et les bases de données SQLite3: • Connexion Python avec...
    Projets en Python: • Adress Book With Pytho...
    Python Django: • Premier Projet Avec Dj...
    PyQt5 débutant GUI Python: • 1 - Introduction A La ...
    Learn PyQt5: • Install PyQt5 and Firs...

Комментарии • 11