SLC S21 Week2 || Mastering Arrays with NumPy and Qt5 Design

Assalamualaikum my fellows I hope you will be fine by the grace of Allah. Today I am going to participate in the steemit learning challenge season 21 week 2 by @kouba01 under the umbrella of steemit team. It is about Mastering Arrays with NumPy and Qt5 Design. Let us start exploring this week's teaching course.

Create a Python application using PyQt5 that displays Pascal's Triangle based on user input.


image.png

According to the requirement of the task1 to develop pascal triangle I have added the following things in the GUI.

  • Al label at the top to display the name and the next label to represent N for the user.
  • I have added only 1 input field to get input from the user for the number of rows.
  • There is a button to submit the input value and generate triangle according to input.
  • A table widget to display the triangle.

First of all I have imported the GUI task1pascaltringle whcih I created in the Designer. The application is running without any error. You can see that when I am giving the number of rows the application is generating a pascal triangle according to the input. Here we can generate any number of rows pascal triangle. In each row the first and the last element is 1.

Write a Python program that reads two integers N1 and N2 (with 2 ≤ N1 ≤ 100 and 2 ≤ N2 ≤ 100) and calculates their product using the "Russian Multiplication" method.


image.png

According to the requirements of the GUI I have created the above interface for the application. I order to create the required design I have added the following design things in it:

  • A label at the top which is used to display the name of the application.
  • I have used 3 more labels for N1, N2 and Product display.
  • There are 3 input fields. The first two are for the N1 and N2 to get value from the user respectively. And the 3rd input will be used to display the result on run time.
  • A display button to perform the functionality.

At the top I have imported the .ui file for the application. Then I ahve connected the button with the user interface.

You can check the working of the application. The first two fields are getting input from the user within the specific range. And when I am clicking the button Display the application is calculating the product with russian multiplication and it is displaying the result in the output field. But before calculating it checks the condition of the entered numbersd. If they meet the condition then the result will be displayed otherwise the application will throw error.

Create a Python application using PyQt5 that allows users to fill, display, and sort a matrix.


image.png

According to the requirements of the design I have created the aboce design by adding these design elements in the interface.

  • There is a label at the top. Another label for N.
  • I have used an input field to get the number from the user to generate matrix.
  • On the GUI there are two buttons, A Fill button and a Sort button.
  • Two radio buttons one radio button is to sort the matrix by rows and the second is to sort the matrix by columns.
  • Two table widgets to display the original matrix and a sorted matrix.

In the video tyou can see the smooth working of the application. It is creating amatrix randomly and then we can sort the matrix by rows and by columns. Each time I click the fill button it generates a different matrix within the given range. The rows and columns remains same but the inside elements are changed.


image.png

The above graphical user interface has been created using these elements:

  • To design this required interface I have added 3 labels. The top label is used to display the name. The next label is used to display the instruction for the nput. ANd the third label is to display the output. I have styles this by giving red color to it.

  • In this interface there is only one input field to get the number from the user.

  • In the above design there are a total of 3 buttons. Each button has different name and attribute.

In the video you can see at the top I have imported UI of the application. Then there is the remaining python code to make the application functional. When the user inputs number it is checked and the relevant output is shown according to the criteria of the condition.


I invite @fombae, @josepha, @lirvic to join this learning challenge.

Sort:  
Loading...

Upvoted! Thank you for supporting witness @jswit.

Coin Marketplace

STEEM 0.21
TRX 0.20
JST 0.033
BTC 96864.77
ETH 3282.21
USDT 1.00
SBD 3.01