Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class ATM(Tk): def __init__(self,account=BankAccount(),parent=None): 'constructor' Tk.__init__(self, parent) self.make_widgets() self.title('ATM') def withdraw(self): 'withdraw funds from BankAccount and update GUI' try : number = float(self.amountE.get()); if self.amount>=number:

class ATM(Tk):

def __init__(self,account=BankAccount(),parent=None):

'constructor'

Tk.__init__(self, parent)

self.make_widgets()

self.title('ATM')

def withdraw(self):

'withdraw funds from BankAccount and update GUI'

try :

number = float(self.amountE.get());

if self.amount>=number:

self.amount-=number

messagebox.showinfo("Transaction", "Please collect the cash....")

else:

messagebox.showinfo("Transaction", "Error, Unable to withdraw funds.")

self.screeen.config(text = self.amount)

except:

messagebox.showinfo("Transaction", "Amount entered is not a number")

self.clear()

def deposit(self):

'add funds to BankAccount and update GUI'

try:

self.balance += amount

self.screen.config(text = amount)

messagebox.showinfo('Successful deposit')

except:

messagebox.showinfo('Amount entered is not a number')

def updateBalance(self):

'Update account balance label in GUI'

pass

def make_widgets(self):

'Create widgets'

self.title('ATM')

Label(self.master, text="Balance : ").grid(row=0, column=0)

Label(self.master, text="Amount : ").grid(row=1, column=0)

self.amountE = Entry(self)

self.amountE.grid(row = 1, column = 1)

Button(self.master, text='Withdraw',command=self.withdraw).grid(row=2, column=0, sticky=W, pady=4)

Button(self.master, text='Deposit',command=self.deposit).grid(row=2, column=1, sticky=W, pady=4)

mainloop()

it gave me an error with sticky W that is not defined please check the code

in python

image text in transcribed
image text in transcribed
inter each transaction. 0 ATM Balance Amount: Withdraw Deposit 0 ATM Balance Amount: Withdraw Deposit Transaction X Amount entered is not a number OK ATM 1 Balance Amount 100 Amount 109 Withdraw Deposit Click withdraw: Transaction Error. Error. Unable to withdraw funds. OK 0 A. Balance Amount 100 Withdraw Deposit Click Deposit: Transaction i Sucessful deposit OK A Balance Amount With 1000 Depose

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

explain what is meant by redundancy

Answered: 1 week ago