Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#pip install tkinter import tkinter as tk from tkinter import * import tkinter.messagebox #GUI root = tk . Tk ( ) root.title ( Currency
#pip install tkinter
import tkinter as tk
from tkinter import
import tkinter.messagebox
#GUI
root tkTk
root.titleCurrency converter:"
Tops Frameroot bg #eee pady width height relief"ridge"
Tops.gridrow column
headlabel tkLabelTops fontlato black', 'bold' text'Currency converter :
bg#eee fg'black'
headlabel.gridrow column stickyW
variable tkStringVarroot
variable tkStringVarroot
variablesetcurrency
variablesetcurrency
#Function To For Real Time Currency Conversion
def RealTimeCurrencyConversion:
from forexpython.converter import CurrencyRates
c CurrencyRates
fromcurrency variableget
tocurrency variableget
if Amountfield.get:
tkinter.messagebox.showinfoError "Amount Not Entered.
Please a valid amount."
elif fromcurrency "currency" or tocurrency "currency":
tkinter.messagebox.showinfoError
"Currency Not Selected.
Please select FROM and TO Currency form menu."
else:
newamt cconvertfromcurrency, tocurrency, floatAmountfield.get
newamount float:fformatnewamt
Amountfield.insert strnewamount
#clearing all the data entered by the user
def clearall:
Amountfield.delete tkEND
Amountfield.delete tkEND
CurrenyCodelist INR "USD", "CAD", CNYDKK "EUR"
root.configurebackground#eee
root.geometryx
Label Labelroot fontlato black', 'bold' text padx pady bg#eee fg"black"
Labelgridrow column stickyW
label tkLabelroot fontlato black', 'bold' textt Amount : bg#eee fg"black"
labelgridrow column stickyW
label tkLabelroot fontlato black', 'bold' textt From Currency : bg#eee fg"black"
labelgridrow column stickyW
label tkLabelroot fontlato black', 'bold' textt To Currency : bg#eee fg"black"
labelgridrow column stickyW
label tkLabelroot fontlato black', 'bold' textt Converted Amount : bg#eee fg"black"
labelgridrow column stickyW
Label Labelroot fontlato black', 'bold' text padx pady bg#eee fg"black"
Labelgridrow column stickyW
Label Labelroot fontlato black', 'bold' text padx pady bg#eee fg"black"
Labelgridrow column stickyW
FromCurrencyoption tkOptionMenuroot variableCurrenyCodelist
ToCurrencyoption tkOptionMenuroot variableCurrenyCodelist
FromCurrencyoption.gridrow column ipadx stickyE
ToCurrencyoption.gridrow column ipadx stickyE
Amountfield tkEntryroot
Amountfield.gridrow column ipadx stickyE
Amountfield tkEntryroot
Amountfield.gridrow column ipadx stickyE
Label Buttonroot fontarial 'bold' text Convert padx pady bg"lightblue", fg"white",
commandRealTimeCurrencyConversion
Labelgridrow column
Label Labelroot fontlato black', 'bold' text padx pady bg#eee fg"black"
Labelgridrow column stickyW
Label Buttonroot fontarial 'bold' text Clear All padx pady bg"lightblue", fg"white",
commandclearall
Labelgridrow column
root.mainloop
show me the output of the code in vs code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started