SLC S21W1 || Creating Dynamic Interfaces with Python and Qt5

in dynamicdevs-s21w1 •  18 hours ago 

We are at it again friends and I welcome you to this post. It is my pleasure to have you here.

1000204136.png
Edited with canvas

Develop detailed documentation to guide a user through the installation of the working environment including Thonny and Qt5 Designer. This guide should be structured and contain the precise steps you followed to install these tools so that a beginner can reproduce the installation without difficulty.

Downloading and installing Thonny and Qt5 designers was very simple for me, based on the steps given by the professor. Let me first take you through the installation process of Thonny

Thonny Installation

1000204076.png

  • From the Thonny website, I then click on Windows since my system isn't Linux or macOS. However, if you are using macOS or Linux you can select any of them.

th2.PNG

  • I then choose the version of software that is compatible with my laptop. 64-bit is what my device is using which I then choose for my Windows 10.

  • As you can see, I now have the Thonny Software downloaded on my PC which I then installed.

th3.PNGth4.PNG
  • After I have downloaded Thonny, I then follow the installation process and install it. For the installation, I select "Install for me only" since it is a personal computer.

  • I then click on Next and Accept the installation license to use the software.

  • I select the folder in which I want the software to be installed.

th6.PNGth7.PNGth8.PNG
  • I then create a desktop icon by clicking on the box that was shown to me and ready to install.
`th10.PNGth11.PNG
  • I waited a few minutes for the installation process to be completed which then became a success which you can see in the provided screenshot.

th12.PNG


Qt Designer Installation

Qt Designer is typically a tool for designing graphic user interfaces for the application using Qt which with the help of PyQt libraries can convert our design into Python code.

ot.PNG

  • From the website, I choose Windows (31. MB) and wait for the Qt designer to be downloaded.

qt1.PNG

  • From my browser, I checked my download and installed the QT designer.
qt2.PNGqt3.PNG
  • The installation process, involves me clicking on Next, Install which I then waited for the installation to be completed.

qt4.PNG

You can see that I have successfully installed the qt designer.


Configuring Thonny to Use Qt for Python

For me to work with PyQt5 in Thonny, I will need to install the PyQt5 package which I did the configuration directly from Thonny via the steps shared below.

  • I open Thonny which you can see from the screenshot.

q-t.PNG

  • I go to Tools and then Manage Packages.

q-t2.PNG

  • I then type PyQt5 in the search bar and select it

q-t3.PNG

q-t4.PNG

  • I click on Install and wait for the installation process to be completed.

Installation of pyqt5-tools

PyQt5-tools is the tool that helps to build graphical user interfaces I will be showing you how you can install it in Thonny.

  • Form Thonny which you can see from the screenshot.

  • I go to Tools and then Manage Packages.

  • I then type PyQt5-tools in the search bar and select it

q-t5.PNG

  • I click on Install and wait for the installation process to be completed.

Verification of Installation

After the installation, I must verify the installation to ensure the smooth running of my program which I create a new Python file and import the PyQt5 libraries into the script as seen from the screenshot.

t.PNG

I then ran the code in Thonny to see the GUI which was successfully run as seen in the screenshot.

t1.PNG


Create a GUI in PyQt5 to display prime numbers between two values a and b provided by the user.

Here I create a PyQt5 that lets the user input two values (a and b), choose to display the prime numbers between the two values in descending order if desired, and then display the results. Reset, and quit buttons are included.

t3.PNG

  • I Open Qt Designer and create the layout by clicking on the main window.

  • The input field is the QLineEdit widgets that allow users to input the values for a and b.

The descending order checkbox is the QcheckBox that allows the user to choose to display the numbers in descending order.

pr.PNG

Display, Reset, and Quit Buttons, display prime numbers in the interval, which the reset is to clear all input fields and results, whereas the quit, is to close the application. However, my challenge was adding colors to the design.


Develop a GUI in PyQt5 to perform the prime factorization of a positive integer greater than 1

This is the function that calculates the prime factors of n by dividing it by each factor beginning from 2 until the number is factories completely

fact.PNG


Develop a GUI in PyQt5 to calculate the number of combinations of p elements among n (notation ( C(n, p) )), where n > p > 0

Here I have created a basic PyQt5 GUI that lets users input values for n and p and then calculate the number of combinations.

e.PNG

Thank you for stopping by

Cc:-
@kuoba01


I am inviting: @dove11, @simonnwigwe, and @lhorgic

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Great job bro...it you dedication to these things for me, am still wondering if I can really understand this haven skipped lectures for a very long time.

Seriously you can even do better than me if you have the determination.