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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started