Question: 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

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
Get step-by-step solutions from verified subject matter experts
