(feat): Added simple exit button
This commit is contained in:
parent
cc53fe9c41
commit
49528323af
1 changed files with 8 additions and 0 deletions
|
|
@ -57,6 +57,11 @@ class TimeLogix(tk.Tk):
|
||||||
|
|
||||||
self.log_text = tk.Text(self, height=10, state=tk.DISABLED)
|
self.log_text = tk.Text(self, height=10, state=tk.DISABLED)
|
||||||
self.log_text.pack(pady=5, padx=10, fill='both', expand=True)
|
self.log_text.pack(pady=5, padx=10, fill='both', expand=True)
|
||||||
|
|
||||||
|
self.exit_button = tk.Button(
|
||||||
|
self, text="Exit", width=10, command=self.exit_app
|
||||||
|
)
|
||||||
|
self.exit_button.pack(pady=5)
|
||||||
|
|
||||||
def log_message(self, message):
|
def log_message(self, message):
|
||||||
if hasattr(self, 'log_text'):
|
if hasattr(self, 'log_text'):
|
||||||
|
|
@ -226,6 +231,9 @@ class TimeLogix(tk.Tk):
|
||||||
self.total_hours = total_duration.total_seconds() / 3600
|
self.total_hours = total_duration.total_seconds() / 3600
|
||||||
self.total_hours_label.config(text=f"Total Hours Worked: {self.total_hours:.2f}")
|
self.total_hours_label.config(text=f"Total Hours Worked: {self.total_hours:.2f}")
|
||||||
|
|
||||||
|
def exit_app(self):
|
||||||
|
self.destroy()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = TimeLogix()
|
app = TimeLogix()
|
||||||
app.mainloop()
|
app.mainloop()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue