Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Monday, January 4, 2021

IP Location Tracker Using Python Tkinter | Full Project With Source Code | Download .exe Installer | All Info

Macstock

In this Post, I have Managed to Make an Amazing IP Location Tracker Using Python TKinter. It can easily find anyone Current Location Using His/Her IP Address. So if you like it, then Please Subscribe to My Channel to Never Miss an Update.

Source Code and .exe Files Downlaod Links are Given Below, Make Sure To Check them Out.

About this App :-

This is an App which is Builded and Designed By me for Windows Devices. It can Easily Locate anyone Current Location By Just Entering His/Her IP Address. It can also show the Location on a Political Map which Can Be Zoomed in and Out. So if you like the App, the Please Comment Down Below :)

Want to Install It without Python, Download from these links :-

How to Use :-

▶Make Sure you have Python Installed in your PC :)

First of All, Install the Packages Listed Below. After that download the indian_states.json File from Below and Paste them inside a Folder. After that, Make a File Inside the Folder where you pasted the "indian_states.json" file and name it as "IpTracker.py". After that,Copy the Code From Below and Open the ipTracker.py Using Notepad, Now Paste the code there. After that Run it Using Python. You can use the App.

Python Libararies To Install Before Copying Codes

Simply Open Your Terminal [You can Use 'Command Prompt' Or 'Windows Powershell' also. And Run These Commands there to Install These Packages.

pip install folium

pip install urllib3

Souce Code Here :-



from tkinter import *
from tkinter import PhotoImage
import json
import os
import urllib3
from tkinter import messagebox
import folium
import webbrowser

root =  Tk()
root.geometry("600x500")
root.title("IP Location Tracker")
root.config(bg="grey")
root.resizable(False, False)

def location_find():
    try:
        ip_input = input_ip_entry.get()
        url = "http://ip-api.com/json/" + ip_input
        http = urllib3.PoolManager()
        response = http.request('GET', url)
        values = json.loads(response.data)
        lati = float(values['lat'])
        longi = float(values['lon'])
        country.set(values['country'])
        city.set(values['city'])
        region.set(values['region'])
        time.set(values['timezone'])
        isp.set(values['isp'])

        fg = folium.FeatureGroup("IP Tracker")
        fg.add_child(folium.GeoJson(data=(open("india_states.json", 'r', encoding="utf-8-sig").read())))
        fg.add_child(folium.Marker(location=[lati, longi], popup="This is Your Location"))

        map = folium.Map(location=[lati, longi], zoom_start=7)
        map.add_child(fg)
        map.save("map.html")
    except EXCEPTION as e:
        messagebox.askretrycancel("Error", "Please Enter a Valid IP Address")


title = Label(root, text="IP Location Tracker", bg="grey", fg="white", font=("ubuntu", 20), pady="20px")
title.pack(anchor="center")

input_ip = Label(root, text="Enter any IP Address :- ", bg="grey", fg="cyan", font=("ubuntu", 14))
input_ip.place(x="30px", y="70px")

def on_click(e):
    btn_finder['bg'] = "white"
    btn_finder['fg'] = "black"

def on_leave(e):
    btn_finder['bg'] = "brown"
    btn_finder['fg'] = "white"

input_ip_entry = Entry(root, bg="beige", fg="black", font=("ubuntu", 14), width=25)
input_ip_entry.place(x="200px", y="71px")

btn_finder = Button(root, text="Find Location", bg="brown", fg="white", font=("ubuntu", 15), cursor="hand2", command=location_find)
btn_finder.bind("<Enter>", on_click)
btn_finder.bind("<Leave>", on_leave)
btn_finder.place(x="170px", y="110px")

country_label = Label(root, text="Country :- ", bg="grey", fg="lime", font=("ubuntu", 14))
country_label.place(x="80px", y="160px")

country = StringVar()
country_entry = Entry(root, textvariable=country, fg="brown", state="readonly", width=23, font=("ubuntu", 14))
country_entry.place(x="160px", y="162px")

region_label = Label(root, text="Region :- ", bg="grey", fg="lime", font=("ubuntu", 14))
region_label.place(x="80px", y="190px")

region = StringVar()
region_entry = Entry(root, textvariable=region, fg="brown", state="readonly", width=23, font=("ubuntu", 14))
region_entry.place(x="160px", y="192px")

city_label = Label(root, text="City :- ", bg="grey", fg="lime", font=("ubuntu", 14))
city_label.place(x="80px", y="220px")

city = StringVar()
city_entry = Entry(root, textvariable=city, fg="brown", state="readonly", width=23, font=("ubuntu", 14))
city_entry.place(x="160px", y="222px")

time_label = Label(root, text="TimeZone :- ", bg="grey", fg="lime", font=("ubuntu", 14))
time_label.place(x="80px", y="250px")

time = StringVar()
time_entry = Entry(root, textvariable=time, fg="brown", state="readonly", width=23, font=("ubuntu", 14))
time_entry.place(x="160px", y="252px")

isp_label = Label(root, text="ISP :- ", bg="grey", fg="lime", font=("ubuntu", 14))
isp_label.place(x="80px", y="280px")

isp = StringVar()
isp_entry = Entry(root, textvariable=isp, fg="brown", state="readonly", width=23, font=("ubuntu", 14))
isp_entry.place(x="160px", y="282px")

def btn_mapclick():
    try:
        webbrowser.open("map.html")
    except Exception as e:
        messagebox.askretrycancel("A Problem Has Been Occured", "Please First Find Your IP then Press this Button")

btn_map = Button(root, text="Show Location On Map", bg="black", fg="white", font=("ubuntu", 15), cursor="hand2", command=btn_mapclick)
btn_map.place(x="130px", y="320px")

root.mainloop()
    

Hope You Will Like It

Tuesday, November 17, 2020

🔥How to Make Password Generator Using Python Tkinter🔥| Explained In English and Hindi | With Source Code

Macstock

In this post, I have managed to Show you how you can easily create a Simple and Easy Password Generator Using Python Tkinter. So if you like it then Please Comment Down Below.

Source Code and .exe Files Downlaod Links are Given Below, Make Sure To Check them Out.

About this App :-

This is an App which is Builded and Designed By me for Windows Devices. It Can easily Generate Unlimited Random Strong Password for your use by just pressing a button. It doesn't requires internet connection, so you can also use it when you are offline. You can use this Applications for generating strong and random passwords for your business accounts, etc. So if you like the App, then Please Comment Down Below :)

Want to Install It without Python, Download from these links :-

How to Use :-

▶Make Sure you have Python Installed in your PC :)

Make a File Anywhere and name it as "password_generator.py". After that,Copy the Code From Below and Open the password_generator.py Using Notepad, Now Paste the code there. After that Run it Using Python. You can use the App.

For Better Understanding You Should Watch the Full Video [Explained In Hindi Language] By Clicking the Video Button Given Below


Source Code Here :-


from tkinter import *
from tkinter.ttk import Combobox
from tkinter import messagebox
import string, random

root = Tk()
root.geometry("500x500")
root.title("Kunal Password Generator")
root.config(bg="beige")
root.resizable(False, False)

def password_generate():
    try:
        length_password = solidboss.get()
        small_letters = string.ascii_lowercase
        capital_letters = string.ascii_uppercase
        digits = string.digits
        special_character = string.punctuation
        all_list = []
        all_list.extend(list(small_letters))
        all_list.extend(list(capital_letters))
        all_list.extend(list(digits))
        all_list.extend(list(special_character))
        random.shuffle(all_list)
        password.set("".join(all_list[0:length_password]))
    except:
        messagebox.askretrycancel("A Problem Has Been Occured", "Please Try Again")

all_no = {"1" : "1", "2" : "2", "3" : "3", "4" : "4","5" : "5", "6" : "6", "7" : "7", "8" : "8", "9" : "9", "10" : "10", "11" : "11", "12" : "12", "13" : "13", "14" : "14", "15" : "15", "16" : "16", "17" : "17", "18" : "18", "19" : "19", "20" : "20", "21" : "21", "22" : "22", "23" : "23", "24" : "24", "25" : "25", "26" : "26", "27" : "27", "28" : "28", "29" : "29", "30" : "30"}

Title = Label(root, text="Kunal Password Generator", bg="beige", fg="black", font=("futura", 15, "bold"))
Title.pack(anchor="center", pady="20px")

length = Label(root, text="Select the Length of Your Password :- ", fg="darkgreen", bg="beige", font=("ubuntu", 12))
length.place(x="20px", y="70px")

def on_enter(e):
    generate_btn['bg'] = "grey"
    generate_btn['fg'] = "white"

def on_leave(e):
    generate_btn['bg'] = "orange"
    generate_btn['fg'] = "black"   

solidboss = IntVar()
Selector = Combobox(root, textvariable=solidboss, state="readonly")
Selector['values'] = [l for l in all_no.keys()]
Selector.current(7)
Selector.place(x="240px", y="72px")

generate_btn = Button(root, text="Generate Password", bg="orange", fg="black", font=("ubuntu", 15), cursor="hand2", command=password_generate)
generate_btn.bind("<Enter>", on_enter)
generate_btn.bind("<Leave>", on_leave)
generate_btn.pack(anchor="center", pady="50px")

result_lable = Label(root, text="Generated Password Here :- ", bg="beige", fg="darkgreen", font=("ubuntu", 12))
result_lable.place(x="20px", y="160px")

password = StringVar()
password_final = Entry(root, textvariable= password, state="readonly", fg="blue", font=("ubuntu", 15))
password_final.place(x="200px", y="160px")

root.mainloop()
    

Hope You Will Like It

Thursday, October 22, 2020

Images to One PDF Convertor Using Python TKinter | Full Project With Source Code | Download .exe Installer

Macstock

In this Post, I have Managed to Make an Awesome Images to PDF Convertor Using Python TKinter. So if you like it, then Please Subscribe to My Channel to Never Miss an Update.

Source Code and .exe Files Downlaod Links are Given Below, Make Sure To Check them Out.

About this App :-

This is an App which is Builded and Designed By me for Windows Devices. It Can Convert Many Images to a Single PDF Without Watermark, It Supports so many functions, like Converting PDF to Image, PDF Conversion with Pagination Feature, etc. So if you like the App, the Please Comment Down Below :)

How to Use :-

▶Make Sure you have Python Installed in your PC :)

First of All, Install the Packages Listed Below. After that, Make a File Anywhere and name it as "images_pdf.py". After that,Copy the Code From Below and Open the images_pdf.py Using Notepad, Now Paste the code there. After that Run it Using Python. You can use the App.

Want to Install It without Python, Download from these links :-

Python Libararies To Install Before Copying Codes

Simply Open Your Terminal [You can Use 'Command Prompt' Or 'Windows Powershell' also. And Run These Commands there to Install These Packages.

pip install PIL

pip install pypdf2

Souce Code Here :-


    
        from os import path
        from os import remove
        from threading import Thread
        
        from tkinter import Tk
        from tkinter import filedialog
        from tkinter import ttk
        from tkinter import LabelFrame
        from tkinter import Text
        from tkinter import Scale
        from tkinter import Frame
        from tkinter import Radiobutton
        from tkinter import Checkbutton
        from tkinter import IntVar
        from tkinter import BooleanVar
        from tkinter import Button
        from tkinter import Scrollbar
        from tkinter import Menu
        from tkinter import messagebox
        from tkinter import END
        import webbrowser
        
        from PIL import Image
        
        from PyPDF2 import PdfFileReader
        from PyPDF2 import PdfFileWriter
        
        
        class MainWindow:
        
            def __init__(self, master):
                self.FORMAT = {0: '.pdf', 1: '.jpg'}
                self.SETTINGS_DPI = {0: 72, 1: 100, 2: 150}
                self.SETTINGS_COLOR = {0: '1', 1: 'RGB'}
                self.list_files = ''
                self.filename = ''
                self.lenght_list_files = ''
                self.text_box = Text(master, wrap='char', width=80, height=16)
                self.vscroll_text_box = Scrollbar(
                    master, orient='vertical', command=self.text_box.yview())
                self.hscroll_text_box = Scrollbar(
                    master, orient='horizontal', command=self.text_box.xview())
                self.text_box.config(yscrollcommand=self.vscroll_text_box.set,
                                     xscrollcommand=self.hscroll_text_box.set)
                self.text_box.grid(row=2, column=2, rowspan=4, columnspan=7)
                self.vscroll_text_box.grid(
                    row=2, column=9, rowspan=4, sticky=('se', 'ne'))
                self.hscroll_text_box.grid(
                    row=6, column=2, columnspan=8, sticky=('we', 'ne'))
                #
                #
                # File format settings
                self.labelframe_format = LabelFrame(
                    master, text="File format")
                self.labelframe_format.grid(
                    row=7, column=1, columnspan=1, rowspan=3, sticky='wens')
                self.format_output_file = IntVar()
                self.format_output_file.set(0)
                self.radiobutton_pdf = Radiobutton(self.labelframe_format, text='PDF format',
                                                   variable=self.format_output_file, value=0, command=self.shutdown_button, cursor="hand2")
                self.radiobutton_jpg = Radiobutton(self.labelframe_format, text='JPEG format',
                                                   variable=self.format_output_file, value=1, command=self.shutdown_button, cursor="hand2")
                self.radiobutton_pdf.pack(fill='x')
                self.radiobutton_jpg.pack(fill='x')
                #
                #
                # Set the frame in which we will place the split settings
                self.labelframe_split = LabelFrame(master, text="Pagination")
                self.labelframe_split.grid(
                    row=7, column=2, columnspan=2, rowspan=3, sticky='wens')
                self.scale_split = Scale(self.labelframe_split, from_=0, to=100,
                                         resolution=5, orient="horizontal")
                self.scale_split.pack(fill='both')
             
                # Set the frame in which we will place the file quality settings
                self.labelframe_dpi = LabelFrame(master, text="Quality settings")
                self.labelframe_dpi.grid(
                    row=7, column=4, columnspan=2, rowspan=3, sticky='wens')
                self.dpi = IntVar()
                self.dpi.set(2)
                self.radiobutton_dpi_72 = Radiobutton(self.labelframe_dpi, text='The average',
                                                      variable=self.dpi, value=0, cursor="hand2")
                self.radiobutton_dpi_100 = Radiobutton(self.labelframe_dpi, text='Good',
                                                       variable=self.dpi, value=1, cursor="hand2")
                self.radiobutton_dpi_150 = Radiobutton(self.labelframe_dpi, text='Excellent',
                                                       variable=self.dpi, value=2, cursor="hand2")
                self.radiobutton_dpi_72.pack(fill='both')
                self.radiobutton_dpi_100.pack(fill='both')
                self.radiobutton_dpi_150.pack(fill='both')
                #
                #
                # Frame with color or b / w selection settings
                self.labelframe_color = LabelFrame(master, text="Color settings")
                self.labelframe_color.grid(
                    row=7, column=6, columnspan=2, rowspan=3, sticky='wens')
                self.color = IntVar()
                self.color.set(1)
                self.radiobutton_bw = Radiobutton(self.labelframe_color, text='Black / white',
                                                  variable=self.color, value=0, cursor="hand2")
                self.radiobutton_color = Radiobutton(self.labelframe_color, text='Colored',
                                                     variable=self.color, value=1, cursor="hand2")
                self.radiobutton_bw.pack(fill='both')
                self.radiobutton_color.pack(fill='both')
                #
                #
                # Frame with JPEG compression quality settings
                self.labelframe_quality = LabelFrame(
                    master, text="File compression setting")
                self.labelframe_quality.grid(
                    row=7, column=8, columnspan=2, rowspan=3, sticky='nw ne')
                self.scale_quality = Scale(self.labelframe_quality, label='Worse                   Better', from_=1, to=100,
                                           resolution=1, orient="horizontal", state='active')
                self.scale_quality.set(100)
                self.scale_quality.pack(fill='both')
                #
                #
                # Checkbox for quality optimization
                self.optimize_image = BooleanVar()
                self.optimize_image.set(False)
                self.checkbutton_optimize = Checkbutton(
                    self.labelframe_quality, text='Automatically', variable=self.optimize_image, onvalue=True, offvalue=False)
                self.checkbutton_optimize.pack()
                self.checkbutton_optimize.bind(
                    '<Button>', lambda event: self.change_state(event))
                #
                #
                # Set the frame in which we will place the main command buttons
        
                def color_change(e):
                    self.button_open["background"] = "brown"
                    self.button_open["foreground"] = "white"
        
                def color_reverse(e):
                    self.button_open["background"] = "lime"
                    self.button_open["foreground"] = "black"
        
                def color_change2(e):
                    self.button_save["background"] = "darkblue"
                    self.button_save["foreground"] = "white"
        
                def color_reverse2(e):
                    self.button_save["background"] = "cyan"
                    self.button_save["foreground"] = "black"
        
                def color_change3(e):
                    self.button_run["background"] = "pink"
                    self.button_run["foreground"] = "black"
        
                def color_reverse3(e):
                    self.button_run["background"] = "black"
                    self.button_run["foreground"] = "white"
        
                self.button_frame = Frame(master)
                self.button_frame.grid(row=2, column=1, rowspan=4)
                self.button_open = Button(self.button_frame, text="Add Images",
                                          command=self.listFiles, pady=5, padx=3,  cursor="hand2", bg="lime")
                self.button_open.bind("<Enter>", color_change)
                self.button_open.bind("<Leave>", color_reverse)
                self.button_open.pack()
                self.button_save = Button(self.button_frame, text="Save PDF",
                                          command=self.savefileName, bg="cyan", pady=5, padx=10, cursor="hand2")
                self.button_save.bind("<Enter>", color_change2)
                self.button_save.bind("<Leave>", color_reverse2)
                self.button_save.pack()
                self.button_run = Button(self.button_frame, text="Run",
                                         command=lambda x=True: ConvertFile().process(
                                             input_file=self.list_files, output_file=self.filename,
                                             format_file=self.FORMAT[self.format_output_file.get(
                                             )], dpi=self.SETTINGS_DPI[self.dpi.get()],
                                             color=self.SETTINGS_COLOR[self.color.get()],
                                             optimize=self.optimize_image.get(),
                                             quality=self.scale_quality.get(), split_step=self.scale_split.get()),
                                          pady=5, padx=23, cursor="hand2", bg="black", fg="white")
                self.button_run.bind("<Enter>", color_change3)
                self.button_run.bind("<Leave>", color_reverse3)
                self.button_run.pack()
                #
                #
                # Progressbar
                self.pbar = ttk.Progressbar(
                    master, orient='horizontal', mode='determinate', length=100, maximum=100)
                self.pbar.grid(row=10, column=1, columnspan=9, sticky='wens')
                #
                #
                # Program menu
                self.menu = Menu(master)
                master.config(menu=self.menu)
                self.sub_menu1 = Menu(self.menu)
                self.menu.add_cascade(label='File', menu=self.sub_menu1)
                self.sub_menu1.add_command(label='Exit', command=self.closed_window)
                self.sub_menu2 = Menu(self.menu)
                self.sub_menu2.add_command(label="About Us", command=self.about_us)
                self.menu.add_cascade(label='Information', menu=self.sub_menu2)
        
            def about_us(self):
                about = messagebox.askokcancel("About Us", "This Program is Created and Developed By An Individual Developer Named Kunal Gupta.\n\nIf you Will Press OK, then you will be redirected to My Website and My Youtube Channel.")
                if about==True:
                    webbrowser.open("https://macstockofficial.blogspot.com/")
                    webbrowser.open_new_tab("https://www.youtube.com/channel/UCIXud9Ot8pfDQizzdmQ-FyQ?sub_confirmation=1")
                else:
                    return "None"
        
        
            def frange(self, start, stop, step):
                while start < stop:
                    yield start
                    start += step
        
            def change_state(self, event):
                if self.optimize_image.get() is False:
                    self.scale_quality.config(state='disable')
                else:
                    self.scale_quality.config(state='active')
        
            def shutdown_button(self):
                if self.format_output_file.get() == 1:
                    self.button_save.config(state='disable')
                else:
                    self.button_save.config(state='active')
        
            def update_progressbar(self, page):
                step = 100 / self.lenght_list_files
                step_range = list(self.frange(0, 100, step))
                self.pbar['value'] = step_range[page] + step
                root.update()
        
            def show_error(self, message):
                messagebox.showerror(title='ERROR', message=message)
        
            def closed_window(self):
                exitfunction = messagebox.askyesno("Exit Kunal Images to PDF Convertor", "Are You Sure you Want to Exit?")
                if exitfunction==True:
                    root.destroy()
                else:
                    return "None"
        
            def listFiles(self):
                """The function is tied to the" Add files "button. The result of the function is a list of files, which is displayed in the text_box field"""
                self.list_files = filedialog.askopenfilenames()
                self.lenght_list_files = len(self.list_files)
                self.text_box.delete(1.0, END)
                for i in self.list_files:
                    self.text_box.insert(END, i)
                    self.text_box.insert(END, '\n')
                return self.list_files
        
            def savefileName(self):
                """The function is tied to the" Save file "button. The result of the function is the full path to the output file"""
                default = self.FORMAT[0]
                setting_format = self.FORMAT[self.format_output_file.get()]
                self.filename = filedialog.asksaveasfilename(filetypes=[(f"File format *{setting_format}",
                                                                         f"*{setting_format}")],
                                                             defaultextension=default)
                return self.filename
        
        
        class ConvertFile:
            """
        
            The class is responsible for converting image files to PDF, JPEG, PNG formats.
            For PDF files, it is possible to split into parts with a specified number of pages.
        
            """
        
            def numberSteps(self, num_page, page_start, page_step):
                """
        
                The function creates a list of range values ​​into which the file is split
        
                """
                steps = list(range(page_start, num_page, page_step))
                steps.append(num_page)
                return steps
        
            def splitPdf(self, input_file, step):
                """
        
                The function divides PDF into files according to the specified range.
                The range is specified in pages. The function returns multiple files,
                by the number of ranges (the name is generated by default).
                \ n input_file: file name, required parameter, type str.
                \ n step: step of the range in pages, int type.
        
                """
                pdf_input = PdfFileReader(open(input_file, 'rb'))
                steps = self.numberSteps(num_page=pdf_input.getNumPages(),
                                         page_start=0, page_step=step)
                new_outfile_path, new_outfile_format = path.splitext(input_file)
                x = 1
                for i in steps:
                    if x < len(steps):
                        pdf_output = PdfFileWriter()
                        for z in list(range(i, steps[x])):
                            pdf_output.addPage(pdf_input.getPage(z))
                        file_part = new_outfile_path + \
                                    f"-page-{i}-{steps[x]}" + new_outfile_format
                        with open(file_part, 'wb') as pdf_output_stream:
                            pdf_output.write(pdf_output_stream)
                    else:
                        continue
                    x += 1
        
            def to_image(self, in_file, optimize, quality, dpi, color, format_file='JPEG'):
               
                input_path, input_format = path.splitext(in_file)
                out_file = input_path + '.' + format_file
                im = Image.open(in_file)
                size = im.size
                new_size = (size[0] // 2, size[1] // 2)
                img_resize = im.resize(size=new_size, resample=1, reducing_gap=3.0)
                img = img_resize.convert(mode=color)
                img.save(out_file, format_file, quality=quality, optimize=optimize,
                         dpi=(dpi, dpi), progressive=True)
                return out_file
        
            def process(self, input_file, output_file, format_file, dpi, color, optimize, quality, split_step=0):
                try:
                    """
        
                    The function is responsible for starting the conversion process.
                    \ n input_file: list of files, type str.
                    \ n output_file: name of the resulting file, type str.
                    \ n format_file: format of the resulting file (values ​​from the series are passed to the function: PDF, JPG, PNG), str type.
                    \ n dpi: number of dots per inch (values ​​from the range: 72, 100, 150 are passed to the function), int type.
                    \ n split_step: step for splitting the PDF file (specified in pages), int type.
                    \ n return: files are saved in the directory.
        
                    """
                    output_path, output_format = path.splitext(output_file)
                    page = 0
                    for i in input_file:
                        """Start updating the progress bar in a separate process"""
                        Thread(target=app.update_progressbar(page)).start()
                        if format_file == '.pdf':
                            """first convert to JPEG format"""
                            output_jpg = self.to_image(
                                i, optimize, quality, dpi, color, 'JPEG')
                            """JPEG is added to the PDF file, we select the parameters of the add function based on the page number"""
                            if page == 0:
                                im = Image.open(output_jpg)
                                im.save(output_file, 'PDF', save_all=True)
                            elif page > 0:
                                im = Image.open(output_jpg)
                                im.save(output_file, 'PDF', append=True)
                            remove(output_jpg)
        
                        elif format_file == '.jpg':
                            self.to_image(i, optimize, quality, dpi, color, 'JPEG')
                        else:
                            pass
                        page += 1
                    if format_file == '.pdf' and split_step > 0:
                        self.splitPdf(output_file, step=split_step)
                    else:
                        messagebox.askokcancel("Successfully Completed",
                                               "Your PDF File Generated Succesfully, at the Location You Entered.")
        
                except:
                    messagebox.askretrycancel("A Problem Has Been Occured", "Please Save the File First")
        
        
        # main window
        if __name__ == "__main__":
            root = Tk()
            root.geometry('780x410+140-140')
            root.resizable(0, 0)
            root.iconbitmap('./img.ico')
            root.title('Kunal Images to PDF Convertor')
            app = MainWindow(root)
            root.config(bg="darkgrey")
            root.mainloop()
    

Hope You Will Like It

Tuesday, September 8, 2020

[SOLVED] Python Scripts Folder is Empty and Pip Not Recognised Error Is Showing After Setting Up Environment Variable

Macstock

In This Post, I have Managed to Show You How You Can Easily Fix The Problem : Script Folder is Empty in Python

Basically, It is Not an Error, It is a Bug Of Python which is Faced By a Lot of Users.

For Better Understanding You Should Watch the Full Video [Explained In Hindi Language] By Clicking the Video Button Given Below


Steps to Fix This Error :

Step 1 : Uninstall Python By Going to The Folder Where You Put Python Installer File and Open It And Click Uninstall.

Step 2 : Click "Customize Installation" and Make Sure That "Add Python 3.8 to Path" Is Ticked

Step 3 : Check The Following Options :

✓ ‑ Install For All Users

✓ ‑ Associate Files With Python(Requires the Py Launcher)

✓ ‑ Create Shortcuts For Installed Applications

✓ ‑ Add Python To Environment Variables

✓ ‑ Precompile Standard Library

Step 4 : Enter Any Drive D: Or E: Path But Not Enter C: Drive Path in the Customize Install Location Bar and Click Install Button

Step 5 : After Installation Completes, Click The Finish Button and Go to the Path You Put in The Install File Location

Open Scripts Folder, You will See that "Easy_install.exe"is there.

Step 6 : Open Command Prompt And Run These Commands :

easy_install pip

easy_install webencodings

easy_install requests

Step 7 : Go to Your Python Main Folder Where You Installed It and Open "lib". In "lib" open "site-packages". In "site-packages" open "requests-2.24.0-py3.8.egg" and Copy "requests" Folder From There.
"\Python 3.8\Lib\site-packages\requests-2.24.0-py3.8.egg"

Step 8 : Go to Site-packages and Open "pip" folder. In Pip open "_vendor" and Paste The Folder in There.
"\Python 3.8\Lib\site-packages\pip\_vendor"

Step 9 : Go to Site Packages and Open "webencodings-0.5.1-py3.8.egg" folder and Copy "webencodings" folder from It.
"\Python 3.8\Lib\site-packages\webencodings-0.5.1-py3.8.egg"

Step 10 : Paste The Folder in "_vendor" Folder of pip.

Step 11 : Go to Site Packages and Open "urllib3-1.25.10-py3.8.egg" folder and Copy "urllib3" folder from it
"\Python 3.8\Lib\site-packages\urllib3-1.25.10-py3.8.egg"

Step 12 : Paste The Folder in "_vendor" Folder of pip.

All Work Done Now Go and Use Pip.


If Nothing Worked for You, then an alternative solution for you. Download Scripts Folder Files and lib folder Files From Below and Paste in Your Computer Original Location.

Monday, September 7, 2020

Repeating Sum Calculator Using Python | Full Details | Source Code | All About | Simple Code

Macstock

Repeating Sum Calculator Using Python

In This Python Program, You can easily Add Numbers Just By Entering Number and Pressing Enter, You Can Do It As Much as You Want, Coz this is in a While Loop.

You Do not Have To Install any Python Library to Run this Program, Very Simple and Short Codes are Given, Just Copy them and Paste In Your IDE or Python Official IDLE.


sum = 0
while (True):
    userInput = int(input("Enter the Price : \n"))
    if (userInput!='q'):
        sum = sum + int(userInput)
        print("Your Order Total So far : ", sum)
        

    else:
        print("Thanks For Using Our Calculator")
        print("The Total Sum : ", sum )
        break