forked from kishanrajput23/Java-Projects-Collections
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChangeClockTime.py
32 lines (27 loc) · 979 Bytes
/
ChangeClockTime.py
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
from tkinter import * # Import tkinter
from StillClock import StillClock
def setNewTime():
clock.setHour(hour.get())
clock.setMinute(minute.get())
clock.setSecond(second.get())
window = Tk() # Create a window
window.title("Change Clock Time") # Set title
clock = StillClock(window) # Create a clock
clock.pack()
frame = Frame(window)
frame.pack()
Label(frame, text = "Hour: ").pack(side = LEFT)
hour = IntVar()
hour.set(clock.getHour())
Entry(frame, textvariable = hour, width = 2).pack(side = LEFT)
Label(frame, text = "Minute: ").pack(side = LEFT)
minute = IntVar()
minute.set(clock.getMinute())
Entry(frame, textvariable = minute, width = 2).pack(side = LEFT)
Label(frame, text = "Second: ").pack(side = LEFT)
second = IntVar()
second.set(clock.getMinute())
Entry(frame, textvariable = second, width = 2).pack(side = LEFT)
Button(frame, text = "Set New Time",
command = setNewTime).pack(side = LEFT)
window.mainloop() # Create an event loop