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()
0 Comments:
Post a Comment