You can build a simple desktop currency converter by using Tkinter for the interface and forex-python to request a conversion. The example below accepts an amount and two currency codes, validates the amount before making a request, and displays either the converted value or a useful error message.
What you need
- Python installed in the environment where you will run the app.
- Tkinter, Python’s interface to Tcl/Tk. Tkinter widgets wrap Tcl/Tk commands, and its variable classes—such as
StringVar—connect Python values to interface controls. Python 3.14.8 Tkinter documentation - The
forex-pythonpackage for rate lookup and conversion. Its documented interface includesCurrencyRates.convert()andCurrencyRates.get_rate(). forex-python usage documentation
Install the package in the same Python environment you will use to launch the program:
As an Amazon Associate I earn from qualifying purchases.
python -m pip install forex-python
If your system uses a different Python launcher, use that launcher consistently for both installation and execution.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesBuild the converter
Save the following as currency_converter.py. Enter three-letter currency codes such as USD or INR; the program passes those codes to forex-python. It checks that the amount is numeric and positive before requesting a conversion.
#1 Best Overall
import tkinter as tk
from forex_python.converter import CurrencyRates
rates = CurrencyRates()
def convert_currency():
try:
amount = float(amount_var.get())
except ValueError:
result_var.set("Enter a valid number for the amount.")
return
if amount <= 0:
result_var.set("Enter an amount greater than zero.")
return
source = source_var.get().strip().upper()
target = target_var.get().strip().upper()
if not source or not target:
result_var.set("Enter both currency codes.")
return
try:
converted = rates.convert(source, target, amount)
except Exception as error:
result_var.set(
"Conversion failed. Check the currency codes and your connection."
)
print(f"Conversion error: {error}")
return
result_var.set(f"{amount:g} {source} = {converted:.2f} {target}")
root = tk.Tk()
root.title("Currency Converter")
root.resizable(False, False)
amount_var = tk.StringVar()
source_var = tk.StringVar(value="USD")
target_var = tk.StringVar(value="INR")
result_var = tk.StringVar(value="Enter an amount and currency codes.")
padding = {"padx": 10, "pady": 6}
tk.Label(root, text="Amount").grid(row=0, column=0, sticky="w", **padding)
tk.Entry(root, textvariable=amount_var, width=24).grid(
row=0, column=1, **padding
)
tk.Label(root, text="From (currency code)").grid(
row=1, column=0, sticky="w", **padding
)
tk.Entry(root, textvariable=source_var, width=24).grid(
row=1, column=1, **padding
)
tk.Label(root, text="To (currency code)").grid(
row=2, column=0, sticky="w", **padding
)
tk.Entry(root, textvariable=target_var, width=24).grid(
row=2, column=1, **padding
)
tk.Button(root, text="Convert", command=convert_currency).grid(
row=3, column=0, columnspan=2, pady=8
)
tk.Label(root, textvariable=result_var, wraplength=320).grid(
row=4, column=0, columnspan=2, **padding
)
root.mainloop()
Run it with:
python currency_converter.py
How the conversion works
Tkinter stores and displays the input
The root window contains entry fields for the amount and currency codes, a button, and a result label. Each field is connected to a StringVar, so the callback can read the current text with get() and update the message with set(). Tkinter documents these variable wrappers as the usual way to connect widget values to Python code. Tkinter variables
forex-python performs the request
The button calls convert_currency(). After basic input checks, it invokes rates.convert(source, target, amount), the package’s direct amount-conversion method. For an app that needs to show the rate separately or apply its own calculation, use rates.get_rate(source, target) and multiply the amount by the returned rate instead. The package documentation demonstrates both methods. forex-python usage examples
Rank #2
Displayed precision is not a promise about the rate
The example formats the converted amount to two digits after the decimal point for readability. That is display formatting; it does not change the rate returned by the package or establish how a bank, card issuer, or exchange service would round an actual transaction.
Free tools Windows power users keep installed
One-click scans. No signup required.
Handle errors and rate-source limits
An invalid amount is rejected locally, before a request. The conversion call is wrapped so failures—such as an unsupported code or a network/service problem—produce a message in the window rather than closing the app. The code also prints the underlying error to the terminal for debugging. The package documentation demonstrates these methods but does not establish an exhaustive exception contract, so this example avoids depending on a specific exception class.
Do not treat the displayed figure as a guaranteed real-time quote or a transaction rate. The forex-python usage documentation identifies ratesapi.io as its source, while the package’s PyPI description refers to theratesapi.com and says it provides rates published by the European Central Bank. Those descriptions differ; the cited material does not establish a current update schedule, uptime guarantee, or transaction availability. forex-python documentation · forex-python on PyPI
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Use Decimal for monetary arithmetic
The basic example uses ordinary floating-point values, which matches the package’s default-style examples. If you want decimal arithmetic instead, initialize the class with force_decimal=True and pass a Decimal amount consistently:
from decimal import Decimal
from forex_python.converter import CurrencyRates
rates = CurrencyRates(force_decimal=True)
converted = rates.convert("USD", "INR", Decimal("10.45"))
The package example notes that using an integer or float amount in this mode raises DecimalFloatMismatchError. Convert validated input text to Decimal rather than to float when adapting the GUI for this mode. MicroPyramid forex-python repository
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




