What I have Done in the past two weeks?

In Python and PySide6, I have created a desktop application that displays images captured by Mars rovers according to user-generated parameters and sends the data of the image and rover to the user-entered e-mail id.

Also created a telegram bot that asks for a poll in a telegram group on a specific date and time.


get the source code here

I have used Pyside6 to build the UI and used python to write the code. Used ezmail module of python to send the mail.

Let's understand the code in short:

The code is simple as solving any Low-level CP question. No need of high knowledge in python you can understand the code with basic python knowledge.

Let's deep dive into the code, Firstly, I created a class and inside that class, I created many functions for a different purpose.

The first function is :

def fetchimage(self):

it fetches the data and images from the Nasa- Mars-Rover API and stores in data as json. From that data later we are extracting the required data like images, rover name, landing date, and so on. We are downloading the images in the same directory named images and renaming each image as 0,1,2,3,... increasing order.

The next function is:

def init(self):

This function is responsible for creating UI of the application. I have used QFormlayout of pyside6 for the layout of the application you can other layouts also as per your choice.

I used QComboBox() function to display multiple options in a single button and used QLineEdit() to create an empty box in which the user can enter some value.

QtWidgets.QPushButton() function is used for creating a widget of button type.

The next function is :

def imageDownloading(self):

The function is used for displaying a pop-up notification on the screen that image is downloading when the user clicks on the fetch-image button.

QMessageBox() is an inbuilt pop-message box in pyside6.

The next function is:

def showmsg(self):

It shows an error pop-up notification if no photos found on that parameter.

The next function is:

def deletePrevData(self):

This function starts working when the user clicks on the fetch image button. It deletes the previous data and images from the directory using the os module of python and makes empty space to download new images based on new parameters.

The next function is:

def viewimage(self):

This function is mainly responsible for displaying the image on the screen along with three buttons and one empty box. I have used QtGui.QPixmap() to display the downloaded images.

The next function:

def nextimage(self):

def previmage(self):

These two functions are used to increase and decrease the count variable every time button is clicked. The count variable is the name of the photo that is displayed on the screen.

The next function:

def sendmail(self):

This function is responsible for sending the image and data to the mail id entered .

I have used ezmail, you can also SMTP which is convineint

The next function:

def mailsent(self):

This function displays a pop-up notification after the mail is sent successfully.

Foodybot

get the code here

I have used sendpoll() function of python to send poll automatically to any group in which bot is added using its group chat id.

I have used scheduler module of python to schedule the bot on any day at any time.

my github profile

my linkdin profile