Mar-31-2023, 09:58 PM
(This post was last modified: Mar-31-2023, 09:58 PM by deanhystad.)
Your indentation is all over the place. This is correct:
And this is wrong:
import tkinter as tk class Profit: def __init__(self, master):This is wrong:
self.calculate_button.grid(row=2, column=0) def rule(master): #<- Should be same indentation as __init__. Should also be blank line before def rule(master): return 72/master# Should be indented 4 space from line above.
And this is wrong:
# create the main window and profit object root = tk.Tk() # <- Should be no spaces, not 1 pro = Profit(root) root.mainloop()Your rule method is not written correctly (see my first post). It is likely you'll need to change the code where you call the method too.