Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need to rewrite the following code in python using the Graphic user interface (GUI) via tkinter , please make sure the code works after

i need to rewrite the following code in python using the Graphic user interface (GUI) via tkinter , please make sure the code works after you rewrite it,

my original code is about an ATM software , once you start the program it will say welcome to the ATM software, where you can create new account or sign in to an existing account, if you choose create an account, you have to put your first and last name date of birth address and the debit card number which must be 16 digits and 4 digit pin , once it is created will say account created successfully, and if you want to sign in to the account you have to use the same debit card 16 digits number and the same pic to be able to sign in to the existing account , then you can either view the balance which should start with zero, or deposit or withdraw, and every time you add or remove money the balance get updated, and finally you ca view your updated balance or exit the software,

i already have my code to do all this i just need to rewrite in in python in a way that i can transfer it into GUI graphic user interface

i already posted this question and some expert answered it and the program doesn't run

so please do not waste my time if you have no expertise or knowledge to really do what i am asking do not try to answer it and waste my attempts are limited , unless u knwo what you are doing ,

here is my code

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 2. Withdraw 3. View balance 4. 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 2. Login 3. 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.") 

THIS IS THE OUTPUT: AFTER I RUN IT

Welcome to the ATM software 1. Create account 2. Login 3. Exit Enter your choice: 1 Enter first name: ihab Enter last name: atouf Enter date of birth (dd/mm/yyyy): 01/01/1990 Enter address: tucson Enter debit card number (16 digits): 1234123412341234 Enter 4-digit pin: 1990 Account created successfully! 1. Create account 2. Login 3. Exit Enter your choice: 2

........etc

here is my begginer attempt to redo this as GUI

from tkinter import * root = Tk() myLabel1 = Label(root, text="Welcome to the ATM Software", padx=100, pady=100) myButton1 = Button(root, text="Create an Account", padx=10, pady=10, fg="blue") myButton2 = Button(root, text="sign in to an existing account", padx=10, pady=10, fg="red") """#to position them in one spot the positioning is relative""" myLabel1.grid(row=0, column=0) myButton1.grid(row=1, column=0) myButton2.grid(row=2, column=0) root.mainloop() 

and this is a pic of kinda what i wanted to look

and when you create account you have to input all data :

like where you can write in a entry box

but of course do it more professionally looking , just read my code and rewrite it in GUI , but make sure your code runs

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

When is a truncated scale most likely to be acceptable?

Answered: 1 week ago

Question

Identify cultural barriers to communication.

Answered: 1 week ago