transfer this code into GUI Tkinter in python print("Welcome to the ATM software") class ATM: def __init__(self): self.accounts = {} def create_account(self): first_name = input("Enter first name: ") last_name = input("Enter last name: ") dob = input("Enter date of birth (dd/mm/yyyy): ") address = input("Enter address: ") debit_card = input("Enter debit card number (16 digits): ") while len(debit_card) != 16 or not debit_card.isdigit(): debit_card = input("Invalid debit card number. Enter debit card number (16 digits): ") pin = input("Enter 4-digit pin: ") while len(pin) != 4 or not pin.isdigit(): pin = input("Invalid pin. Enter 4-digit pin: ") self.accounts[debit_card] = {"first_name": first_name, "last_name": last_name, "dob": dob, "address": address, "pin": pin, "balance": 0} print("Account created successfully!") def login(self): debit_card = input("Enter debit card number: ") pin = input("Enter pin: ") if debit_card in self.accounts and self.accounts[debit_card]["pin"] == pin: while True: print("1. Deposit\n2. Withdraw\n3. View balance\n4. Logout") choice = input("Enter your choice: ") if choice == "1": amount = float(input("Enter deposit amount: ")) self.accounts[debit_card]["balance"] += amount print("Deposit successful. Current balance : $", self.accounts[debit_card]["balance"]) elif choice == "2": amount = float(input("Enter withdraw amount: ")) if amount <= self.accounts[debit_card]["balance"]: self.accounts[debit_card]["balance"] -= amount print("Withdraw successful. Current balance : $", self.accounts[debit_card]["balance"]) else: print("Insufficient balance.") elif choice == "3": print("Current balance: $", self.accounts[debit_card]["balance"]) elif choice == "4": print("Logged out.") break else: print("Invalid choice.") else: print("Invalid debit card or pin.") atm = ATM() while True: print("1. Create account\n2. Login\n3. Exit") choice = input("Enter your choice: ") if choice == "1": atm.create_account() elif choice == "2": atm.login() elif choice == "3": print("Exiting...") break else: print("Invalid choice.")
transfer this code into GUI Tkinter in python
print("Welcome to the ATM software")
class ATM:
def __init__(self):
self.accounts = {}
def create_account(self):
first_name = input("Enter first name: ")
last_name = input("Enter last name: ")
dob = input("Enter date of birth (dd/mm/yyyy): ")
address = input("Enter address: ")
debit_card = input("Enter debit card number (16 digits): ")
while len(debit_card) != 16 or not debit_card.isdigit():
debit_card = input("Invalid debit card number. Enter debit card number (16 digits): ")
pin = input("Enter 4-digit pin: ")
while len(pin) != 4 or not pin.isdigit():
pin = input("Invalid pin. Enter 4-digit pin: ")
self.accounts[debit_card] = {"first_name": first_name, "last_name": last_name, "dob": dob, "address": address,
"pin": pin, "balance": 0}
print("Account created successfully!")
def login(self):
debit_card = input("Enter debit card number: ")
pin = input("Enter pin: ")
if debit_card in self.accounts and self.accounts[debit_card]["pin"] == pin:
while True:
print("1. Deposit\n2. Withdraw\n3. View balance\n4. Logout")
choice = input("Enter your choice: ")
if choice == "1":
amount = float(input("Enter deposit amount: "))
self.accounts[debit_card]["balance"] += amount
print("Deposit successful. Current balance : $", self.accounts[debit_card]["balance"])
elif choice == "2":
amount = float(input("Enter withdraw amount: "))
if amount <= self.accounts[debit_card]["balance"]:
self.accounts[debit_card]["balance"] -= amount
print("Withdraw successful. Current balance : $", self.accounts[debit_card]["balance"])
else:
print("Insufficient balance.")
elif choice == "3":
print("Current balance: $", self.accounts[debit_card]["balance"])
elif choice == "4":
print("Logged out.")
break
else:
print("Invalid choice.")
else:
print("Invalid debit card or pin.")
atm = ATM()
while True:
print("1. Create account\n2. Login\n3. Exit")
choice = input("Enter your choice: ")
if choice == "1":
atm.create_account()
elif choice == "2":
atm.login()
elif choice == "3":
print("Exiting...")
break
else:
print("Invalid choice.")
Step by step
Solved in 3 steps with 2 images