Posts

Python GUI Classic Example using KivyMD and Kivy (ScreenManager, position, MD, Images, Carousel etc.)

Image
 Wallpaper Application Hi Guys! hope you all are doing well. I have created a GUI application based on python. I have used Kivy, Kivymd in this project to handle the material design. In this example you can see Boxlayout, Swiping between different screens, Labels, Images and many more thing. Requirement : Install Kivy, kivymd in you pc. Link: https://pypi.org/project/kivymd/            https://kivy.org/doc/stable/installation/installation-windows.html Below is the source code and output screenshot. from kivymd.app import MDApp from kivy.lang.builder import Builder from kivy.uix.screenmanager import Screen , ScreenManager screen_helper= ''' ScreenManager: MenuScreen: ProfileScreen: ImageScreen: <MenuScreen>: name : 'menu' MDLabel: text:'Hi! Happy to see you here.' theme_text_color:'Custom' text_color: 0.20,0.596,0.85,1 halign:'center' MDTextField: helper_text...

Program to delete all the zip files present in destination

Image
 Code to delete all the 'Zip' Files present in destination. This code will help you to remove any files from the drive not just zip file. You will have to do little modification in the piece of code as per your requirement. Before After Code #Program to delete zip files present in destination import os destination = 'F:/remove' def remove_zip_files (destination): for filename in os.listdir(destination): if filename.endswith( '.zip' ): print ( 'Unlinking File' +filename) rem = destination+ '/' +filename print (rem) os.unlink(rem) else : print ( 'No Zip files found' ) remove_zip_files(destination) __author__ = "HEMANT KUMAR" Share your valuable comments.

Download Application to convert Image to Pdf (Simple to Use)

Image
 Image2Pdf Convertor Hi Guys, This application is useful when you need to convert any image into Pdf format which is required during form filling process.  Hope this will help you out.  Below is the link to download the application. Download Convertor Step1: Click on above link to download the application. Once it is downloaded. Click on open and unzip the file. Step2: Once Unzip is done. Click on the Img2Pdf application. It will look like this. Step3: Click on Select the Image File button to select the file for which you want to perform the conversion. Step4: Click on Convert to Pdf button to save the pdf, and enter the name. I have entered check as name and then click on save. Step5: Everything done. Check the converted file. Hope it will help you all. Let me know in case of any queries or any update. 

Tkinter version of Python code for Image conversion into PDF.

Image
  This is the Tkinter version(GUI)/Advanced version of Image conversion into PDF. Pre-Requisites : Install Pillow using command "'pip install Pillow' In this version we are using Tkinter to create a window application which will help us in upgrading the basic version of our image conversion code. We are going to read the file using dialog box and when we perform the convert operation it will open a dialog box to save the file and we have to provide the saving filename. I have tried to keep the code very simple and ready to use. Hope it will help you in your project and in learning process. Before Click on Select the Image file button then choose the file to convert. After Click on Convert to PDF button . Enter the name and click on save button. Exit Application Button Below is the source code for this conversion. Comment in case of any queries.                              

PYTHON CODE TO CONVERT IMAGE FILE INTO PDF(Basic version)

Image
 This is the basic version of Image conversion into PDF. Pre-Requisites : Install Pillow using command "pip install Pillow" BASIC VERSION This is the basic version on conversion where we will provide the image file in our code and it will convert into PDF. This code is for the single file conversion. Hope it will help to learn.  Before We are converting img file into pdf. After run In this screenshot we can see that there is one file name called "Convert.pdf", which is the pdf version of img. Below is the source Code. If you want to merge the multiple image files into Pdf then get all the files and append them into a list and perform the convert operation. It will work.  Comment in case of any queries or issues.  

Python code to search for all the zip files in the directory and unzip them.

Image
 Before  After running the code. Below is the Code. # Program to fetch all the zip files and unzip them import os,zipfile, pathlib path_dir = 'F:/ck' entries = pathlib.Path(path_dir) files_present_dir = [] for entry in entries.iterdir():     files_present_dir.append(entry.name)     #print(*files_present_dir,sep="\n")   l = len(files_present_dir) for check_file in range(0,l):     temp = files_present_dir[check_file]     if temp.find('.zip') != -1:         s = path_dir + '/' + temp         with zipfile.ZipFile((s), 'r') as zip:             zip.printdir()  #List all the files present in zip             print('Extracting all the files...')             zip.extractall(path='F:/ck')             print('Done!!') __author__ = "Hemant Kumar Chauhan"