Showing posts with label Libaries to Install. Show all posts
Showing posts with label Libaries to Install. Show all posts

Friday, September 25, 2020

Currency Convertor Using Python | Source Code | LIbararies to Install | Other Details

Macstock

In this post, I have managed to Build an Amazing Currency Convertor Using Python Tkinter. The App has an Fallback that is not big problem, that Zimbabwe Dollar cannot be Used. We are Working On it and Soon it Will be Used.

I have Used Only Two Modules in this Projects and One Pre Installed Module Named TKinter. So If you want to Download this Program, you can download to and the Downloaded File WIll be Installed in your Computer.

For Better Understanding You Should Watch the Videos[Explained in Hindi Language]Step-By-Step By Clicking the Video Buttons Given Below


Part 1

Part 2

Part 3

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 google-currency

pip install json


I have Used One File Named "ind.txt" in My Code, Here is the Link to Download the File :

Souce Code Here :-


from tkinter import *
from tkinter import messagebox
from tkinter.ttk import Combobox
from google_currency import convert
import json


root = Tk()
root.geometry("600x400")
root.title("Currency Convertor By Kunal")
# root.iconbitmap("Your Icon.ico")
root.config(bg="lightgreen")
root.resizable(False, False)

with open('ind.txt') as k:
    lines = k.readlines()


currencyDict = {}
for line in lines:
    parsed = line.split("\t")
    currencyDict[parsed[1]] = parsed[2]
    
def funtiol():
    try:
        lan = currentbox.get()
        paol = currencyDict[lan]
        lap = currentbox2.get()
        olop = currencyDict[lap]
        serial = varb.get()
        rider = convert(paol, olop, serial)
        json_dict = json.loads(rider)
        semibox = json_dict["amount"]
        var1.set(semibox)
    except:
        semiboss = messagebox.askretrycancel('A Problem Has Been Occured', 'Please Check Your Internet Connection, Change Your Currency or Amount you Have Entered')  
        if (semiboss==True):
            return "None"


Title = Label(root, text="Currency Convertor By You", font=('ubuntu', 20, "italic"), bg="lightgreen", fg="red")
Title.place(x=120, y=10)

Lable1 = Label(root, text="Enter the Amount to Convert :- ", font=('ubuntu', 15, "bold"), bg="lightgreen", fg="brown")
Lable1.place(x=10, y=70)

varb = IntVar()
MainBox = Entry(root, textvar=varb, bg="grey", fg="lightblue", width=25, font=('ubuntu', 15, "bold"))
MainBox.place(x=315, y=70)

Label2 = Label(root, text="Select the Currency to Convert Your Amount From :-",  font=('ubuntu', 10, "bold"), bg="lightgreen", fg="blue")
Label2.place(x=10, y=140)

Label3 = Label(root, text="Select the Currency to Convert Your Amount to :-",  font=('ubuntu', 10, "bold"), bg="lightgreen", fg="blue")
Label3.place(x=10, y=180)

Lable4 = Label(root, text="Converted Amount Here :- ", font=('ubuntu', 15, "bold"), bg="lightgreen", fg="brown")
Lable4.place(x=10, y=300)

btn1 = Button(root, text="Convert", font=('ubuntu', 15, "bold"),  command=funtiol,  bg="lightblue", fg="orange", relief=RAISED,\
                         cursor="hand2")
btn1.place(x=250, y=230)

var1 = IntVar() 
mainint = Entry(root, textvariable=var1, fg="orange", width=28, font=('ubuntu', 15, "bold"), state="readonly")
mainint.place(x=270, y=300)

footer = Label(root, text="Build and Developed By You", font=('ubuntu', 15, "italic"), bg="lightgreen", fg="grey")
footer.place(x=120, y=360)

#Combobox 1 
currentbox = StringVar()
combo_box = Combobox(root, width=30, textvar=currentbox, state="readonly")
combo_box['values'] = [item for item in currencyDict.keys()]
combo_box.current(4)
combo_box.place(x=360, y=140)

#Combobox 2
currentbox2 = StringVar()
combotake = Combobox(root, width=30, textvar=currentbox2, state="readonly")
combotake['values'] = [item for item in currencyDict.keys()]
combotake.current(0)
combotake.place(x=360, y=180)


root.mainloop()
    

Tuesday, September 22, 2020

Simple Calculator Using Python | Source Code | LIbararies to Install | Other Details

Macstock

In this Post, I have managed to Build an Amazing Calculator Using Python Tkinter. If you like it then please Comment Down Below.

It does not require any Type of Library Installation, Just Requires Tkinter Which is Pre Installed in Python Package

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

Souce Code Here :-



# Libaries Imported
from tkinter import *

#Main Configurations
root = Tk()
root.geometry("400x440")
root.configure(bg="grey")
root.title("Your Name Calculator")
root.iconbitmap("calc.ico")
root.resizable(False, False)

#Functions to Run

def press(event):
    global varname1
    text = event.widget.cget("text")
    if text == "=":
        if varname1.get().isdigit():
            value = int(varname1.get())
        else:
            value = eval(mainbox.get())

        varname1.set(value)
        mainbox.update()
    elif text == "C":
        varname1.set("")
        mainbox.update()
    else:
        varname1.set(varname1.get() + text)
        mainbox.update()
# Main Box
varname1 = StringVar()
mainbox = Entry(root, width="17", textvar=varname1, state="readonly", font=('ubuntu', 30, 'bold'))
mainbox.place(x=10, y=2)

# Buttons to Add 

btn9 = Button(root, text="9",padx=13, bg="pink", fg="white", font=('ubuntu', 20, 'bold'),)
btn9.place(x=15, y=60)
btn9.bind("<Button-1>",  press)

btn8 = Button(root, text="8",padx=13, bg="pink", fg="white", font=('ubuntu', 20, 'bold'))
btn8.place(x=115, y=60)
btn8.bind("<Button-1>",  press)

btn7 = Button(root, text="7",padx=13, bg="pink", fg="white", font=('ubuntu', 20, 'bold'))
btn7.place(x=215, y=60)
btn7.bind("<Button-1>",  press)

btn6 = Button(root, text="6",padx=13, bg="pink", fg="white", font=('ubuntu', 20, 'bold'))
btn6.place(x=15, y=150)
btn6.bind("<Button-1>",  press)

btn5 = Button(root, text="5",padx=13, bg="pink", fg="white", font=('ubuntu', 20, 'bold'))
btn5.place(x=115, y=150)
btn5.bind("<Button-1>",  press)

btn4 = Button(root, text="4",padx=13, bg="pink", fg="white", font=('ubuntu', 20, 'bold'))
btn4.place(x=215, y=150)
btn4.bind("<Button-1>",  press)

btn3 = Button(root, text="3",padx=13, bg="pink", fg="white", font=('ubuntu', 20, 'bold'))
btn3.place(x=15, y=240)
btn3.bind("<Button-1>",  press)

btn2 = Button(root, text="2",padx=13, bg="pink", fg="white", font=('ubuntu', 20, 'bold'))
btn2.place(x=115, y=240)
btn2.bind("<Button-1>",  press)

btn1 = Button(root, text="1",padx=13, bg="pink", fg="white", font=('ubuntu', 20, 'bold'))
btn1.place(x=215, y=240)
btn1.bind("<Button-1>",  press)

btnstar = Button(root, text="*",padx=15, bg="pink", fg="white", font=('ubuntu', 20, 'bold'))
btnstar.place(x=115, y=330)
btnstar.bind("<Button-1>",  press)

btnslash = Button(root, text="/",padx=17, bg="pink", fg="white", font=('ubuntu', 20, 'bold'))
btnslash.place(x=215, y=330)
btnslash.bind("<Button-1>",  press)

btnadd = Button(root, text="+",padx=13, bg="pink", fg="white", font=('ubuntu', 20, 'bold'))
btnadd.place(x=15, y=330)
btnadd.bind("<Button-1>",  press)

btnminus = Button(root, text="-",padx=15, bg="pink", fg="white",  font=('ubuntu', 20, 'bold'))
btnminus.place(x=315, y=330)
btnminus.bind("<Button-1>",  press)

btnC = Button(root, text="C",padx=9, pady=15, bg="red", fg="white", font=('ubuntu', 20, 'bold'))
btnC.place(x=315, y=230)
btnC.bind("<Button-1>",  press)

btnequal = Button(root, text="=",padx=11, pady=48, bg="blue", fg="white", font=('ubuntu', 20, 'bold'))
btnequal.place(x=315, y=60)
btnequal.bind("<Button-1>",  press)

Label1 = Label(root, text="Designed and Developed By Your Name", fg="yellow", bg="grey", font=('ubuntu', 15, 'bold'))
Label1.place(x=3, y=400)



root.mainloop()
    

Friday, September 18, 2020

Text Translator Using Python | Source Code | Libaries to Install | Other Details | Full Details

Macstock

In This Post, I Have Managed to Build an Amazing Translator Tool Using Python Tkinter, If You Like it the please Comment down below.

It Supports All Languages Translation, So do not Worry if you not Want to Translate In Hindi or You are not an Indian.

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 playsound

pip install tkinter

pip install pygame

pip install textblob

Souce Code Here :-



# Libraries Imported
from playsound import playsound
from tkinter import *
from tkinter import messagebox
import winsound
from tkinter.ttk import Combobox
import pygame
from textblob import *

# Main Configurations
root = Tk()
root.geometry("800x400")
root.title("Kunal Translator")
root.resizable(False, False)
root.configure(bg="grey")
# root.iconbitmap("Your Icon.ico")
lan_dict = {'afrikaans': 'af', 'albanian': 'sq', 'amharic': 'am', 'arabic': 'ar', 'armenian': 'hy', 'azerbaijani': 'az', 'basque': 'eu', 'belarusian': 'be', 
'bengali': 'bn', 'bosnian': 'bs', 'bulgarian': 'bg', 'catalan': 'ca', 'cebuano': 'ceb', 'chichewa': 'ny', 'chinese (simplified)': 'zh-cn', 'chinese (traditional)': 'zh-tw', 'corsican': 'co', 'croatian': 'hr', 'czech': 'cs', 'danish': 'da', 'dutch': 'nl', 'english': 'en', 'esperanto': 'eo', 'estonian': 'et', 'filipino': 'tl', 'finnish': 'fi', 'french': 'fr', 'frisian': 'fy', 'galician': 'gl', 'georgian': 'ka', 'german': 'de', 'greek': 
'el', 'gujarati': 'gu', 'haitian creole': 'ht', 'hausa': 'ha', 'hawaiian': 'haw', 'hebrew': 'he', 'hindi': 'hi', 'hmong': 'hmn', 'hungarian': 'hu', 'icelandic': 'is', 'igbo': 'ig', 'indonesian': 'id', 'irish': 'ga', 'italian': 'it', 'japanese': 'ja', 'javanese': 'jw', 'kannada': 'kn', 'kazakh': 'kk', 'khmer': 'km', 'korean': 'ko', 'kurdish (kurmanji)': 'ku', 'kyrgyz': 'ky', 'lao': 'lo', 'latin': 'la', 'latvian': 'lv', 'lithuanian': 'lt', 'luxembourgish': 'lb', 'macedonian': 'mk', 'malagasy': 'mg', 'malay': 'ms', 'malayalam': 'ml', 'maltese': 'mt', 'maori': 'mi', 'marathi': 'mr', 'mongolian': 'mn', 'myanmar (burmese)': 'my', 'nepali': 'ne', 'norwegian': 'no', 'odia': 'or', 'pashto': 'ps', 'persian': 'fa', 'polish': 'pl', 
'portuguese': 'pt', 'punjabi': 'pa', 'romanian': 'ro', 'russian': 'ru', 'samoan': 'sm', 'scots gaelic': 'gd', 'serbian': 'sr', 'sesotho': 'st', 'shona': 'sn', 'sindhi': 'sd', 'sinhala': 'si', 'slovak': 'sk', 'slovenian': 'sl', 'somali': 'so', 'spanish': 'es', 'sundanese': 'su', 'swahili': 'sw', 'swedish': 'sv', 'tajik': 'tg', 'tamil': 'ta', 'telugu': 'te', 'thai': 'th', 'turkish': 'tr', 'ukrainian': 'uk', 'urdu': 'ur', 'uyghur': 'ug', 'uzbek': 'uz', 'vietnamese': 'vi', 'welsh': 'cy', 'xhosa': 'xh', 'yiddish': 'yi', 'yoruba': 'yo', 'zulu': 'zu'}

# Functions to Run
pygame.mixer.init()
def sound(event=None):
    try:
        pygame.mixer.music.load("Your Song.mp3")
        pygame.mixer.music.play()
        word3 = TextBlob(varname1.get())
        lan = word3.detect_language()
        lan_todict = language.get()
        lan_to = lan_dict[lan_todict]
        word3 = word3.translate(from_lang=lan, to=lan_to)
        varname2.set(word3)
    except:
        varname2.set("A Problem Has Been Occured")    
def mainexit():
    rr = messagebox.askyesnocancel('Exit Your Translator', 'Are You Want to Exit Kunal Translator Machine', parent= root)
    if (rr==True):
        root.destroy()

    # Binding [Hover] Functions 
def on_entry1click(e):
    entry1['bg'] = "lightblue"
def on_entry1leave(e):
    entry1['bg'] = "lightgreen"

def on_click(e):
    btn1['bg'] =  "green"
    btn1['foreground'] =  "black"
def on_leave(e):
    btn1['bg'] =  "pink"
    btn1['foreground'] =  "red" 
def on_2click(e):
    btn2['bg'] =  "black"  
    btn2['foreground'] =  "blue"  
def on_2leave(e):
    btn2['bg'] =  "red" 
    btn2['foreground'] =  "white"   

# Combo Box

language = StringVar()
font_box = Combobox(root, width=30, textvariable = language, state="readonly")
font_box['values'] = [e for e in lan_dict.keys()]
font_box.current(37)
font_box.place(x=130, y=147)
# Title Of My Program
label1 = Label(root,foreground="aqua", text="Your Translator Machine", font=('Arial', 15, 'italic bold'), bg="grey")
label1.place(x=278, y=10)

# Translator Boxes

    #Text Feeder
varname1 = StringVar()
entry1 = Entry(root, width=30, bg="lightgreen", textvariable=varname1, font=('ubuntu', 15, 'bold'))
entry1.place(x=400, y=70)

    #Text Output
varname2 = StringVar()
entry2 = Entry(root, width=30, bg="purple", textvariable=varname2, font=('ubuntu', 15, 'bold'), state="readonly")
entry2.place(x=400, y=220)

# # Labels 

    #Translate To 
label4 = Label(root,foreground="white",  text="Translate To :-", font=('ubuntu', 8, 'bold'), bg="grey")
label4.place(x=34, y=147)    
    #Text Feeder Label
label1 = Label(root,foreground="yellow",  text="Enter The Word to Translate :-", font=('ubuntu', 15, 'bold'), bg="grey")
label1.place(x=38, y=70)
    #Text Output Label
label2 = Label(root,foreground="orange", text="Translated Word Here :-", font=('ubuntu', 15, 'bold'), bg="grey")
label2.place(x=56, y=220)

#Buttons Here

    # Translater Button

btn1 = Button(root, text="Translate",  bg="pink", foreground="red",command= sound, font=('ubuntu', 15, 'bold'),relief=RAISED,\
                         cursor="hand2")
btn1.place(x=350, y=140)
root.bind('<Return>, sound)

    # Exit Button

btn2 = Button(root, text="Exit", bg="red",command= mainexit, foreground="white", padx=18, pady=8, font=('ubuntu', 15, 'bold'),relief=RAISED,\
                         cursor="hand2")
btn2.place(x=350, y=350)

#Binding 

    #Text Feeder Binding
entry1.bind('<Enter>', on_entry1click)
entry1.bind('<Leave>', on_entry1leave)


    #Translate Button Binding
btn1.bind('<Enter>', on_click)
btn1.bind('<Leave>', on_leave)

    #Exit Button Binding
btn2.bind('<Enter>', on_2click)
btn2.bind('<Leave>', on_2leave)



root.mainloop()
    

You can Edit these Codes to Make it Your Personal Translator