python

Currency converter using Python tkinter

This tutorial will teach you how to make a currency converter using python.

import tkinter as tk

OptionList1 = [
"USD",

]

OptionList2 = [
"indianrs",
"srilankars",
]

def Ok():

    fr = variable.get()
    to = variable1.get()

    amount = float(e1.get())

    if (fr == "USD" and to == "indianrs"):

        tot = amount * 180

    else:
        tot = amount * 120

    nsalText.set(tot)

root = tk.Tk()
root.geometry('300x200')
root.title("Currency Converver System Python")

variable = tk.StringVar(root)
variable.set(OptionList1[0])

opt = tk.OptionMenu(root, variable, *OptionList1)
opt.config(width=10, font=('Helvetica', 12))
opt.pack(side="top")

variable1 = tk.StringVar(root)
variable1.set(OptionList2[0])

opt = tk.OptionMenu(root, variable1, *OptionList2)
opt.config(width=10, font=('Helvetica', 12))
opt.pack(side="top")

global e1
global nsalText
nsalText = tk.StringVar()
labelTest = tk.Label(text="", font=('Helvetica', 12), fg='red')
labelTest.pack(side="top")


tk.Label(root, text="From").place(x=10, y=10)
tk.Label(root, text="To").place(x=10, y=40)
tk.Label(root, text="Amount").place(x=10, y=80)

tk.Label(root, text="Total:").place(x=10, y=150)
tk.Label(root, text="", font=('Helvetica', 12), fg='red' , textvariable=nsalText).place(x=100, y=150)
tk.Button(root, text="Cal", command=Ok ,height = 1, width = 3).place(x=100, y=110)

e1 = tk.Entry(root)
e1.place(x=80, y=80)

root.mainloop()

I have attached the video tutorial below it will help you  to do this  step by step.

 

admin

Recent Posts

GitHub Copilot vs Microsoft Copilot Best AI Tool to Use in 2025

GitHub is a powerful tool used by teams and developers around the globe. This guide is…

20 hours ago

Chat with Claude AI Free – Your Super-Smart AI Buddy

It's like having a super-smart buddy that is always there to help you write stories,…

5 days ago

Best Festivals UK 2025 [Free Guide Included]

The UK is known for its rich history, diverse culture, and most of all  its…

1 week ago

Bank Holidays 2025 UK – Plan Your Perfect Long Weekends

Do you have a plan for your next holiday? Being aware of the Bank Holidays within the…

1 week ago

Master Cursor AI Full Guide for Students & Creators

The world is rapidly changing of software development AI-assisted tools for coding have become the main focus. As…

1 week ago

Google Gemini AI Free AI Tool for Students & Creators

Google Gemini AI is among the top talked about developments. What exactly is it? What…

1 week ago