Many Types of Coding Programs Source Codes

Many Types of Coding Programs Source Codes

Many Types Of Errors Solved With Full English Explanation and HINDI Video Tutorials

Many Types Of Errors Solved With Full English Explanation and HINDI Video Tutorials

Latest Posts

Monday, January 25, 2021

How to Create a Calculator in C++🤔🤔 | Explained in English | Less than 100 Lines Code

MacStock Official

In this Post, I have Managed to Show you how you Can Easily Create Calculator in C++. It is very Simple and Easy to Create Program.

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


Source Code Here :-


#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
    int inp_number;
    int while_runner = 0;
    int add_first;
    int add_second;
    int sub_first;
    int sub_second;
    int multi_first;
    int multi_second;
    int div_first;
    int div_second;
    cout<<"Welcome to Calculator. Press Enter to Continue"<<endl;
    getchar();
    while (while_runner==0)
    {       
        cout<<"Use any of the Below Functions."<<endl;
        cout<<"Press 1 For Addition"<<endl;
        cout<<"Press 2 For Substraction"<<endl;
        cout<<"Press 3 For Multiplication"<<endl;
        cout<<"Press 4 For Division"<<endl;
        cin>>inp_number;
        if (inp_number==1)
        {
            cout<<"Enter the first Number to Add:- "<<endl;
            cin>>add_first;
            cout<<"Enter the Second Number to Add:- "<<endl;
            cin>>add_second;
            try
            {
                cout<<add_first+add_second<<endl;
            }
            catch(const std::exception& e)
            {
                cout<<"Enter a Valid Number"<<endl;
                break;
            }
            
        }
        else if (inp_number==2)
        {
            cout<<"Enter the first Number to Substract:- "<<endl;
            cin>>sub_first;
            cout<<"Enter the Second Number to Substract:- "<<endl;
            cin>>sub_second;
            try
            {
                cout<<sub_first-sub_second<<endl;
            }
            catch(const std::exception& e)
            {
                cout<<"Enter a Valid Number"<<endl;
                break;
            }
             
        }
        
        else if (inp_number==3)
        {
            cout<<"Enter the first Number to Multiply:- "<<endl;
            cin>>multi_first;
            cout<<"Enter the Second Number to Multiply:- "<<endl;
            cin>>multi_second;
            try
            {
                cout<<multi_first*multi_second<<endl;
            }
            catch(const std::exception& e)
            {
                cout<<"Enter a Valid Number"<<endl;
                break;
            }
            
            
        }

        else if(inp_number==4)
        {
            cout<<"Enter the first Number to Divide:- "<<endl;
            cin>>div_first;
            cout<<"Enter the Second Number to Divide:- "<<endl;
            cin>>div_second;
            try
            {
                cout<<div_first/div_second<<endl;
            }
            catch(const std::exception& e)
            {
                cout<<"Enter a Valid Number"<<endl;
                break;
            }
        
        }
        else {
            cout<<"Enter a Valid Option";
            break;
        }
        
    }

}
    

Hope you Will Like It😊

Monday, January 4, 2021

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

MacStock Official

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 Official

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

Friday, November 6, 2020

Calculator Android App | Android Studio | Full Project With Source Code | Download .apk File on Phone

MacStock Official

In this Post, I have Managed to Build a Calculator Using Android Studio. This is a Basic Calculator Which Performs Several Function.

It is a little bit comlex, so if you are not a Android Developer then You Should Download the .apk File of this App to Use this in your Android Device

About this App :-

This is a Calculator which is designed and developed by me which performs several Calculations like Addition, Substraction, Multiplication, Division, etc. It has Also a About Page Which Contains an Awesome Audiowide Font Look. I builded the app with a dark theme. So if you want Light theme, then simply change the colours.xml File to Make it light theme. This app also has a menu bar. The buttons of this are modern looking awesome designed buttons. So if you like it, then Please Comment Down Below :)

Want to Install It without Android Studio In your Phone, Download from the link :-

For Those, who want to Build OwnSelf :-

How to Use :-

First of all Open Android Studio and Create a New Empty Project, After that wait for the Gradle to Complete Building. After that, Open your project's res folder manually and then delete all the folders inside it. Now Download the Import Files from the Button Given Below and then Extract it using WinRar. After Extracting, Cut the Folders that are formed after Extracting and Paste them Inside your res Folder. Now Copy the MainActivity.java Code From Below and Open your MainActivity.java file and Paste the Code there.Now Create One More Java File where your MainActivity.java exists, and name the File as About_Us.java. After that, Copy the About_us.java code from below and Paste it inside the About_Us.java file. After that, create a New Java File Where you created the previous one, and name it as About_Us_Info.java. Now Copy the About_Us_Info.java Code from below and Paste it inside your About_Us_Info.java file. Now you can run the App :)

First of all Download The Files Given Below and replace it with the files in the "res" Folder of your Project, Like Shown in the Image Below

[MainActivity.java] Source Code :-


package com.macstockofficial.kunalimagestopdfconv;

import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;


import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AppCompatActivity;

import android.text.Layout;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import android.os.Bundle;



public class MainActivity extends AppCompatActivity {
    Button btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btn0, btnAdd, btnMultiply, btnDiv, btnMinus, btnDot, btnEqual;
    Button btnClear;
    EditText ed1;
    Float result1, result2;
    boolean Add, Sub, Multiply, Divide;

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater menuInflater = getMenuInflater();
        menuInflater.inflate(R.menu.menu, menu);
        return true;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        btn1 = (Button) findViewById(R.id.btn1);
        btn2 = (Button) findViewById(R.id.btn2);
        btn3 = (Button) findViewById(R.id.btn3);
        btn4 = (Button) findViewById(R.id.btn4);
        btn5 = (Button) findViewById(R.id.btn5);
        btn6 = (Button) findViewById(R.id.btn6);
        btn7 = (Button) findViewById(R.id.btn7);
        btn8 = (Button) findViewById(R.id.btn8);
        btn9 = (Button) findViewById(R.id.btn9);
        btn0 = (Button) findViewById(R.id.btn0);
        btnAdd = (Button) findViewById(R.id.btnAdd);
        btnMinus = (Button) findViewById(R.id.btnMinus);
        btnMultiply = (Button) findViewById(R.id.btnMultiply);
        btnDiv = (Button) findViewById(R.id.btnDiv);
        btnDot = (Button) findViewById(R.id.btnDot);
        btnEqual = (Button) findViewById(R.id.btnEqual);
        btnClear = (Button) findViewById(R.id.btnClear);
        ed1 = (EditText) findViewById(R.id.editTextTextPersonName);

        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "1");
            }
        });

        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "2");
            }
        });

        btn3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "3");
            }
        });

        btn4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "4");
            }
        });

        btn5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "5");
            }
        });

        btn6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "6");
            }
        });

        btn7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "7");
            }
        });

        btn8.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "8");
            }
        });

        btn9.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "9");
            }
        });

        btn0.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "0");
            }
        });

        btnDot.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ ".");
            }
        });


        btnAdd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ed1==null){
                    ed1.setText("");
                }
                else{
                    result1 = Float.parseFloat(ed1.getText() + "");
                    Add = true;
                    ed1.setText(null);
                }
            }
        });
        btnMinus.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ed1==null){
                    ed1.setText("");
                }
                else{
                    result1 = Float.parseFloat(ed1.getText() + "");
                    Sub = true;
                    ed1.setText(null);
                }
            }
        });

        btnMultiply.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ed1==null){
                    ed1.setText("");
                }
                else{
                    result1 = Float.parseFloat(ed1.getText() + "");
                    Multiply = true;
                    ed1.setText(null);
                }
            }
        });

        btnDiv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ed1==null){
                    ed1.setText("");
                }
                else{
                    result1 = Float.parseFloat(ed1.getText() + "");
                    Divide = true;
                    ed1.setText(null);
                }
            }
        });

        btnEqual.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                result2 = Float.parseFloat(ed1.getText() + "");
                if (Add==true){
                    ed1.setText(result1 + result2 + "");
                    Add = false;
                }
                if (Sub==true){
                    ed1.setText(result1 - result2 + "");
                    Sub = false;
                }
                if (Multiply==true){
                    ed1.setText(result1 * result2 + "");
                    Multiply = false;
                }
                if (Divide==true){
                    ed1.setText(result1 / result2 + "");
                    Divide = false;
                }
            }
        });
        btnClear.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText("");
            }
        });
    }


    public void about_us(MenuItem menuItem){
        Intent intent = new Intent(this, About_us.class);
        startActivity(intent);
    }


    public void about_us_info(MenuItem menuItem){
        Intent intent = new Intent(this, About_Us_info.class);
        startActivity(intent);
    }




}
    

[About_us.java] Source Code :-


package com.macstockofficial.kunalimagestopdfconv;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

public class About_us extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about_us);
    }

    public void subscribe_youtube(View view) {
        Uri uri = Uri.parse("https://www.youtube.com/channel/UCIXud9Ot8pfDQizzdmQ-FyQ?sub_confirmation=1");
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(intent);
    }

    public void visitweb(View view) {
        Uri uri2 = Uri.parse("https://macstockofficial.blogspot.com/");
        Intent intent2 = new Intent(Intent.ACTION_VIEW, uri2);
        startActivity(intent2);
    }

    public void about_us_info(View view){
        Intent intent = new Intent(this, About_Us_info.class);
        startActivity(intent);
    }
}
    

[About_Us_info.java] Source Code :-


package com.macstockofficial.kunalimagestopdfconv;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

public class About_Us_info extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about__us_info);
    }

    public void download_app(View view){
        Uri uri = Uri.parse("https://macstockofficial.blogspot.com/p/my-android-app-download-links-full.html");
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(intent);
    }
}
    

Hope You Will Like the Project.

Tuesday, October 27, 2020

How to Downlaod, Install and Use Bandicam Premium Version For Free | No Watermak | Unlimited Details | Full Details | Explained in English

MacStock Official

In this Post, I have Managed to Tell you How to Download, Install and Use Bandicam Screen Recorder Premium Version For Free.

It Contains No Watermark Recording and No Timer of Recording, Record as long as you want.


Steps to Download and Use Premium Bandicam Version :-

Step 1 : Click the Button Given Below and Download the Bandicam.exe File From there.

Download Bandicam

Step 2 : After Downloading, Just install it Manually and do not run the app.

Step 3 : After Installing finished, Bandicam will be added to Desktop. Right Click on it and Press "Open File Location".

Step 4 : Now Minize the Folder Opened, and Click the Button Given Below and Download the msimg32.dll Zip file from there.

Download msimg32.dll Zip File

Step 5 : After Downloading Extract it Using WinRar. And Enter the Password Given Below.

Password :- macstockofficial.blogspot.com

Step 6 : After Extracting, Cut the msimg32.dll from there and Paste the file in the folder which you minimized before[Install Folder of Bandicam].

After Pasting the DLL File to the Bandicam Folder, Your Work is finished. Now Bandicam is activated for lifetime. Make Sure to Comment Down Below, you liked the post or not.

Saturday, October 24, 2020

Fully Responsive BootStrap 4 Website | Source Code | All Details | Related Images

MacStock Official

This is an Awesome BootStrap 4 Website, with Amazing Layout Design. Services Page and Contact Us Model.

You Can Use it to Create Your Own Website, It is Free to Use. A Very Amazing Looking Website is Presented Here.

About this Website :-

This Website is a Website Made Using HTML and BootStrap 4. It has a Awesome Nav Bar, Amazing Contact Page and an Awesome Gallery Bar. You can also see demo of the website, by clicking the below button. I created this website using a little amount of css, I just Used BootStrap 4 to create this Website. If you want then you can use this website for your own purposes. It does not include a copyright issue, this website is free to use. You can create more pages, then host this website easily on any platform.So if you like the Website, then Please Comment Down Below :)

How to Use :-

Firstly Create a New Folder and Create a New File inside the folder and name it as "index.html" and also create one more file and name it as "style.css". Now Copy the Index.html Source Code From Below and Open your Index.html file using Notepad and paste the Code there, Now Save the File. After Doing that, Copy the style.css code from below and Open your style.css file using Notepad and Paste the Code there, Now Save the File. Now Download the Images From Below and Create a New Folder inside the Folder and Name the Folder "images" and Now Extract the Images that You have downloaded from below(You can use WinRar for Extracting). Now Cut the Images that are formed after Extracting and Paste them inside the images Folder that you had created before.

Want to See Demo of the Website, Click the Button Given Below to See Demo of the Website

See Demo Of the Website

I have Used Some Files in this Project. Download these Files From the Button Below and After Extracting, Paste the Files in your Main Folder where you Keep your html and css File.

Download Important FIles

Source Code Here :-


[Index.html]

            <!DOCTYPE html>
            <html lang="en">
            <head>
                <meta charset="UTF-8">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <title>Example BootStrap Website</title>
                <link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@1,500&display=swap" rel="stylesheet">
                <link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
                <link rel="stylesheet" href="assets/bootstrap/css/bootstrap-grid.css">
                <link rel="stylesheet" href="assets/bootstrap/css/bootstrap-grid.css.map">
                <link rel="stylesheet" href="assets/bootstrap/css/bootstrap-grid.min.css">
                <link rel="stylesheet" href="assets/bootstrap/css//bootstrap-grid.min.css.map">
                <link rel="stylesheet" href="assets/bootstrap/css//bootstrap-grid.min.css.map">
                <link rel="stylesheet" href="style.css">
                <link rel="stylesheet" href="assets/fontawesome-free/css/all.css">
                <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
                <style>
                  html {
                    scroll-behavior: smooth;
                  }
                  a {
                    text-decoration-line: none;
                  }
                  * {
                    margin:0;
                    padding:0;
                    font-family: 'Josefin Sans', sans-serif;
                  }
                  .carousel-inner img {
                    width: 100%;
                    height: 100%;
                  }
                </style>
                </head>
            <body class="bg-light">
            
             <header>
                <!-- Nav Bar Configurations -->
                <nav class="navbar navbar-expand-lg navbar-light bg-dark">
                  <img src="images/macstock.png" alt="Logo" class="float-left sliper" width="50px" height="50px">
                    <a class="navbar-brand text-light" href="#">MacStock Official</a>
                    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                      <span class="navbar-toggler-icon"></span>
                    </button>
                  
                    <div class="collapse navbar-collapse" id="navbarSupportedContent">
                      <ul class="navbar-nav ml-auto">
                        <li class="nav-item disabled">
                          <a class="nav-link text-light" >Home <span class="sr-only">(current)</span></a>
                        </li>
                        <li class="nav-item">
                          <a class="nav-link text-light" href="#">Link</a>
                        </li>
                        <li class="nav-item dropdown ">
                          <a class="nav-link dropdown-toggle text-light" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            Dropdown
                          </a>
                          <div class="dropdown-menu bg-dark" aria-labelledby="navbarDropdown">
                            <a class="dropdown-item text-light" href="#">Action</a>
                            <a class="dropdown-item text-light" href="#">Another action</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item text-light" href="#">Something else here</a>
                          </div>
                        </li>
                        <li class="nav-item active">
                          <a class="nav-link text-light" href="#contact_us" >Contact Us</a>
                        </li>
                      </ul>
                      <form class="form-inline my-2 my-lg-0">
                        <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
                        <button class="btn btn-outline-info my-2 my-sm-0" type="submit">Search</button>
                      </form>
                    </div>
                  </nav>
                  <!-- Nav Bar End -->
            
                  <!-- Image Slider -->
                  <div id="demo" class="carousel slide" data-ride="carousel">
            
                    <!-- Indicators -->
                    <ul class="carousel-indicators">
                      <li data-target="#demo" data-slide-to="0" class="active"></li>
                      <li data-target="#demo" data-slide-to="1"></li>
                      <li data-target="#demo" data-slide-to="2"></li>
                    </ul>
                  
                    <!-- The slideshow -->
                    <div class="carousel-inner">
                      <div class="carousel-item active">
                        <img src="images/liver.jpg" alt="Liver Image">
                      </div>
                      <div class="carousel-item">
                        <img src="images/blade_images.jpg" alt="Balde Image">
                      </div>
                      <div class="carousel-item">
                        <img src="images/amazing_images.jpg" alt="Amazing Image">
                      </div>
                    </div>
                  
                    <!-- Left and right controls -->
                    <a class="carousel-control-prev" href="#demo" data-slide="prev">
                      <span class="carousel-control-prev-icon"></span>
                    </a>
                    <a class="carousel-control-next" href="#demo" data-slide="next">
                      <span class="carousel-control-next-icon"></span>
                    </a>
                  
                  </div>
                  <!-- Image Slider End --> 
                </header>
            
            <!-- About Us  -->
                <section>
                <div class="container-fluid">
                  <h1 class="text-center pt-5">About Us</h1>
                  <hr class="w-50 mx-auto bg-danger mb-5">
            
                  <div class="row mb-5">
                      <div class="col-lg-6 col-md-6 col-12">
                        <img src="images/mountains.jpg" alt="Mountains Image" class="img-fluid">
                      </div>
                      <div class="col-lg-6 col-md-6 col-12">
                        <h2 class="text-center">Who are We?</h2>
                        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Cumque hic, voluptates, error eaque aperiam enim in provident molestias aliquam voluptate totam, explicabo laboriosam quaerat iure non ab aspernatur tenetur voluptatum?
                        Accusamus in dolore accusantium architecto provident necessitatibus delectus ab, quo ex? Illo laboriosam debitis, omnis dolore sit obcaecati, doloremque excepturi libero placeat impedit ut, beatae aut doloribus nisi amet at?
                        Veniam neque sit est velit, distinctio itaque. Quae, doloribus? Tempore iure, debitis non aliquam omnis perferendis repellat reiciendis saepe, voluptate facere aliquid voluptatum culpa quibusdam illum. Totam minus nulla recusandae.
                        Et exercitationem obcaecati quos nostrum accusamus debitis quod deserunt explicabo rerum sapiente eos consectetur non provident atque expedita reprehenderit tempora facilis excepturi placeat laborum modi, inventore officia asperiores. Ducimus, veritatis.</p>
                      </div>
                  </div>
                </section>
            <!-- About Us End -->
            
                <!-- Services Section -->
            
                <section>
                <div class="container-fluid">
                  <h1 class="text-center pt-5">What We Offer in this Website</h1>
                  <hr class="w-50 mx-auto bg-danger mb-5">
            
                <div class="row mb-5">
            
                  <div class="col-lg-4 col-md-4 col-12">
                    <div class="card" style="width:400px">
                      <img class="card-img-top" src="images/mountains.jpg" alt="Card image">
                      <div class="card-body">
                        <h4 class="card-title">Coding Projects</h4>
                        <p class="card-text">We Provide Many Types of Programming Language Programs Source codes and We also Offer Websites Codes for Free</p>
                        <a href="#" class="btn btn-primary">Browse Coding Projects</a>
                      </div>
                    </div>
                  </div>
                  <div class="col-lg-4 col-md-4 col-12">
                    <div class="card" style="width:400px">
                      <img class="card-img-top" src="images/man.jpg" alt="Card image">
                      <div class="card-body">
                        <h4 class="card-title">Paid Games For Free</h4>
                        <p class="card-text">We Provide Many Types of Games for free, if you want to download all type of Games For Absolutely Free, then Visit this Page</p>
                        <a href="#" class="btn btn-primary">Browse Free Games</a>
                      </div>
                    </div>
                  </div>
                  <div class="col-lg-4 col-md-4 col-12">
                    <div class="card" style="width:400px">
                      <img class="card-img-top" src="images/mountains.jpg" alt="Card image">
                      <div class="card-body">
                        <h4 class="card-title">Error Fixing Contents</h4>
                        <p class="card-text">We Provide Many Types of Problem Solving Contents, so if you are facing errors in Pythonor Related to Computers, then Visit this Page</p>
                        <a href="#" class="btn btn-primary">Browse Error Solving</a>
                      </div>
                    </div>
                  </div>
                </div>
                </div>
              </section>
            
                <!-- Services End -->
            <!-- Contact Us -->
                <section class="bg-warning mx-5" id="contact_us">
            
                  <article class="py-5 text-center">
                    <div class="text-light">
                      <h3 class="display-4">Contact Us</h3>
                      <p>If you Have any Queries Left, Contact Us Now!</p>
                      <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
              Contact Us
            </button>
                    </div>
            
                    <div class="modal fade" id="myModal">
                      <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content">
                        
                          <!-- Modal Header -->
                          <div class="modal-header">
                            <h4 class="modal-title">Contact Us</h4>
                            <button type="button" class="close" data-dismiss="modal">×</button>
                          </div>
                          
                          <!-- Modal body -->
                          <div class="modal-body">
                          <form action="#">
                            <div class="form-group">
                              <label for="email">Email address :-</label>
                              <input type="email" class="form-control" placeholder="Enter Your Email Address" id="email">
                            </div>
                            <div class="form-group">
                              <label for="phone_no">Phone Number :-</label>
                              <input type="number" class="form-control" placeholder="Enter Your Phone Number" id="phone_no">
                            </div>
                            <div class="form-group">
                              <label for="message">Message :-</label>
                              <textarea class="form-control" placeholder="Enter the Message You Want to Send to Me" id="message"></textarea>
                            </div>
                            <button type="submit" class="btn btn-primary">Send Message</button>
                          </form>
                          </div>
                          
                          <!-- Modal footer -->
                          <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                          </div>
                          
                        </div>
                      </div>
                    </div>
            
                  </article>
            
                </section>
            <!-- Contact Us End-->
            
            <!-- Gallery Starts Here -->
              <div class="container-fluid">
                <h1 class="text-center pt-5">Gallery</h1>
                <hr class="w-50 mx-auto bg-danger mb-5">
                <div class="row">
                  <div class="col-lg-4 col-md-4 col-12 mb-4">
                    <img src="images/man.jpg" alt="Example Image" class="img-fluid">
                  </div>
                  <div class="col-lg-4 col-md-4 col-12 mb-4">
                    <img src="images/mountains.jpg" alt="Example Image" class="img-fluid">
                  </div>
                  <div class="col-lg-4 col-md-4 col-12 mb-4">
                    <img src="images/man.jpg" alt="Example Image" class="img-fluid">
                  </div>
                  <div class="col-lg-4 col-md-4 col-12 mb-4">
                    <img src="images/mountains.jpg" alt="Example Image" class="img-fluid">
                  </div>
                  <div class="col-lg-4 col-md-4 col-12 mb-4">
                    <img src="images/man.jpg" alt="Example Image" class="img-fluid">
                  </div>
                  <div class="col-lg-4 col-md-4 col-12 mb-4">
                    <img src="images/mountains.jpg" alt="Example Image" class="img-fluid">
                  </div>
                </div>
              </div>
            
              <!-- Copyrights -->
              <footer>
                <h2 class="text-center reddish">Follow Us On</h4>
                <div class="text-center">
                  <a href="https://twitter.com/KunalGu77984717"target = "_blank" class="pol"><i class="fa fa-twitter fa-3x"></i></a>
                  <a href="https://www.youtube.com/channel/UCIXud9Ot8pfDQizzdmQ-FyQ" target = "_blank" class="yt"><i class="fa fa-youtube fa-3x"></i></a>
                  <a href="https://github.com/Kunal767"target = "_blank" class="gt"><i class="fa fa-github fa-3x"></i></a>
                </div> 
                <br>
                <br>
              </footer>
                <div>
                  <h2 class="bg-dark text-light text-center">Copyrights © MacStockOfficial.com | All Rights Reserved | 2020-2026</h2>
                </div> -->
              <!-- Copyrights End -->
            
            
            <!-- Gallery Ends Here -->
                <!-- JavaScripts Scripts -->
                <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
                <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
                <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
            </body>
            </html>
        

[Style.css]

            html {
                scroll-behavior: smooth;
              }
              * {
                margin:0;
                padding:0;
                font-family: 'Josefin Sans', sans-serif;
              }
              .carousel-inner img {
                width: 100%;
                height: 100%;
              }
            .riderping{
                position: relative;
                display: inline-block;
                padding: 15px 30px;
                color : #2196f3;
                text-transform: uppercase;
                letter-spacing: 4px;
                text-decoration: none;
                text-decoration-line: none;
                font-size: 24px;
                overflow: hidden;
                transition: 0.2s;
                   border: 2px solid white;
                   background-color: white;
            }
            .riderping:hover{
                color: #255784;
                background: #2196f3;
                box-shadow: 0 0 10px #2196f3, 0 0 40px #2196f3, 0 0 80px #2196f3;
                transition-delay: 1s;
            }
            .riderping span {
                position: absolute;
                display: block;
            
            }
            .riderping span:nth-child(1) {
                top: 0;
                left: -100%;
                width: 100%;
                height: 2px;
                background: linear-gradient(90deg, transparent, #2196f3);
            }
            .riderping:hover span:nth-child(1) { 
                left: 100%;
                transition: 1s;
            
            }
            .riderping span:nth-child(3) {
                bottom: 0;
                right: -100%;
                width: 100%;
                height: 2px;
                background: linear-gradient(270deg, transparent, #2196f3);
            }
            .riderping:hover span:nth-child(3) { 
                right: 100%;
                transition: 1s;
                transition-delay: 0.5s;
            }
            .riderping span:nth-child(2) {
                top: -100%;
                right: 0;
                width: 2px;
                height: 100%;
                background: linear-gradient(180deg, transparent, #2196f3);
            }
            .riderping:hover span:nth-child(2) { 
                top: 100%;
                transition: 1s;
                transition-delay: 0.25s;
            }
            .riderping span:nth-child(4) {
                bottom: -100%;
                left: 0;
                width: 2px;
                height: 100%;
                background: linear-gradient(360deg, transparent, #2196f3);
            }
            .riderping:hover span:nth-child(4) { 
                bottom: 100%;
                transition: 1s;
                transition-delay: 0.75s;
            }
            
            .gt{
                color: rgb(0, 0, 0);
                text-decoration-line: none;
                margin-right: 16px;
            }
            .gt:hover{
                color: rgb(255, 255, 255);
                
            }
            .yt{
                color: rgb(150, 29, 29);
                text-decoration-line: none;
                margin-right: 16px;
            }
            .yt:hover{
                color: rgb(83, 34, 34);
                
            }
            .pol{
                color: rgb(0, 89, 145);
                text-decoration-line: none;
                margin-right: 16px;
            }
            .pol:hover{
                color: rgb(46, 93, 122);
                
            }
        

Hope you will Like it. Comment Below your feedback!

Thursday, October 22, 2020

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

MacStock Official

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