File size: 1,009 Bytes
c3f3e46
0d39371
c3f3e46
0d39371
c3f3e46
 
 
0d39371
c3f3e46
 
 
 
0d39371
c3f3e46
 
 
 
 
0d39371
c3f3e46
 
ef46ac6
c3f3e46
 
ef46ac6
c3f3e46
 
ef46ac6
c3f3e46
0d39371
c3f3e46
 
 
 
ef46ac6
c3f3e46
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import time
import os
import tkinter as tk

class Clock:
    def __init__(self):
        self.time = time.strftime("%H:%M:%S")

    def show_time(self):
        self.time = time.strftime("%H:%M:%S")
        print(f"The current time is {self.time}")
        return self.time

class UI:
    def __init__(self):
        self.create_window = tk.Tk()
        self.create_window.title("Clock")
        self.create_window.geometry("400x400")

        self.clock_label = tk.Label(self.create_window, text="The time is: ")
        self.clock_label.pack()

        self.clock_entry = tk.Entry(self.create_window)
        self.clock_entry.pack()

        self.clock_button = tk.Button(self.create_window, text="Show Time", command=self.show_time)
        self.clock_button.pack()

        self.create_window.mainloop()

    def show_time(self):
        clock = Clock()
        current_time = clock.show_time()
        self.clock_label.config(text=f"The time is: {current_time}")

if __name__ == "__main__":
    ui = UI()