From 8a307aea225d3b049ae0958c3e9973487ef6bbbf Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Sat, 22 Jul 2023 10:47:08 -0700 Subject: [PATCH] Clear total paid with button --- __main__.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/__main__.py b/__main__.py index ea1e29f..b97f4f8 100644 --- a/__main__.py +++ b/__main__.py @@ -30,7 +30,7 @@ class Window(CTk): # Static label mainLabel: CTkLabel = CTkLabel( master=self.left_frame, - text="Change Due Calculator", + text="Amount Due", font=("Arial", 18, 'bold') ) mainLabel.grid(row=0, column=0, pady=12) @@ -196,6 +196,18 @@ class Window(CTk): if c < 3: c += 1 else: c = 0; r += 1 + clearTotalButtons: CTkButton = CTkButton( + master=self.left_frame_bottom, + text="Clear\nTotal", + font=("Arial", 20, 'bold'), + fg_color="IndianRed3", + hover_color="IndianRed4", + command=self.clearTotal, + width=152, + height=70, + ) + clearTotalButtons.grid(row=3, column=3, pady=12, padx=10) + # Right frame for output self.right_frame: CTkFrame = CTkFrame( master=self, @@ -235,6 +247,10 @@ class Window(CTk): def clear(self) -> None: self.amount.set("") + + def clearTotal(self) -> None: + self.total: float = 0.0 + self.totalLabel.configure(text=f"Total: {self.total:.2f}") if __name__ == '__main__': window = Window()