Course Content
PyQt5 Basics – Installation Process, Qt Designer Intro
In this part we are going to talk about some basics functionalities in PyQt5, we go through installation process, creating QPushButton, Signals and working with Qt Designer.
0/4
PyQt5 Tutorials
About Lesson

In this PyQt5 QML lesson we want to learn about Working with QtQuick & QML in PyQt5, QtQuick is a feature of PyQt5 by using that you can separate your main design from logic. and QtQuick has its own language that is called QML. QML is Qt Markup Language, it is a language similar to JavaScript but it is not JavaScript. So when you want to work with QtQuick you need to create two files in Pycharm IDE, the first one is a QML file and the second one is a Python file.

 

 

Create a file with the .qml extension, i want to call it main.qml and add this code.

So in above code first we have our root element that is our window and in the window you can add your other widgets like Text, Image, InputField and etc. also we have some attributes for the window like width and height, window title and color of the window. 

 

 

Now it is time to load our qml file in python language.

 

 

At the top these are the imports.

 

 

You need to create the object for QApplication and QQmlApplicationEngine.

 

 

In here we have set the icon for the window, make sure that you have added an icon to your working directory.

 

 

 

This is for creating text, it is just a basic text with the color and font size.

 

 

 

Using this code you can add image in the window.

 

 

 

And this code is for adding TextInput

 

 

 

 

Run the complete code and this is the result.

PyQt5 QML - Working with QtQuick & QML in PyQt5
PyQt5 QML – Working with QtQuick & QML in PyQt5
Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found