示例#1
0
    def __init__(self):
        window = Tk()  # Create a window
        window.title("Change Clock Time")  # Set title

        self.clock = StillClock(window)  # Create a clock
        self.clock.pack()

        frame = Frame(window)
        frame.pack()
        Label(frame, text="Hour: ").pack(side=LEFT)
        self.hour = IntVar()
        self.hour.set(self.clock.getHour())
        Entry(frame, textvariable=self.hour, width=2).pack(side=LEFT)
        Label(frame, text="Minute: ").pack(side=LEFT)
        self.minute = IntVar()
        self.minute.set(self.clock.getMinute())
        Entry(frame, textvariable=self.minute, width=2).pack(side=LEFT)
        Label(frame, text="Second: ").pack(side=LEFT)
        self.second = IntVar()
        self.second.set(self.clock.getMinute())
        Entry(frame, textvariable=self.second, width=2).pack(side=LEFT)
        Button(frame, text="Set New Time",
               command=self.setNewTime).pack(side=LEFT)

        window.mainloop()  # Create an event loop
    def __init__(self):
        window = Tk()  # 윈도우를 생성한다.
        window.title("시계 시간 변경하기")  # 제목을 설정한다.

        self.clock = StillClock(window)  # 시계를 생성한다.
        self.clock.pack()

        frame = Frame(window)
        frame.pack()
        Label(frame, text="시: ").pack(side=LEFT)
        self.hour = IntVar()
        self.hour.set(self.clock.getHour())
        Entry(frame, textvariable=self.hour, width=2).pack(side=LEFT)
        Label(frame, text="분: ").pack(side=LEFT)
        self.minute = IntVar()
        self.minute.set(self.clock.getMinute())
        Entry(frame, textvariable=self.minute, width=2).pack(side=LEFT)
        Label(frame, text="초: ").pack(side=LEFT)
        self.second = IntVar()
        self.second.set(self.clock.getMinute())
        Entry(frame, textvariable=self.second, width=2).pack(side=LEFT)
        Button(frame, text="새로운 시각 설정",
               command=self.setNewTime).pack(side=LEFT)

        window.mainloop()  # 이벤트 루프를 생성한다.
    def __init__(self):
        window = Tk()
        window.title('Change Clock Time')

        self.clock = StillClock(window)  # Create a clock
        self.clock.pack()

        frame = Frame(window)
        frame.pack()
        Label(frame, text = 'Hour: ').pack(side = LEFT)
        self.hour = IntVar()
        self.hour.set(self.clock.getHour())
        Entry(frame, textvariable = self.hour,
              width = 2).pack(side = LEFT)
        Label(frame, text = 'Minute: ').pack(side = LEFT)
        self.minute = IntVar()
        self.minute.set(self.clock.getMinute())
        Entry(frame, textvariable = self.minute,
              width = 2).pack(side = LEFT)
        Label(frame, text = 'Second: ').pack(side = LEFT)
        self.second = IntVar()
        self.second.set(self.clock.getSecond())
        Entry(frame, textvariable = self.second,
              width = 2).pack(side = LEFT)
        Button(frame, text = 'Set New Time',
               command = self.setNewTime).pack(side = LEFT)
        window.mainloop()
示例#4
0
    def __init__(self):
        self.window = Tk()
        self.window.title("Change Clock Time")

        self.clock = StillClock(self.window)
        self.clock.pack()

        self.frame = Frame(self.window)
        self.frame.pack()
        frame = self.frame
        Label(frame, text="Hour:").pack(side=LEFT)
        self.hour = IntVar()
        self.hour.set(self.clock.getHour())
        Entry(frame, textvariable=self.hour, width=2).pack(side=LEFT)

        Label(frame, text="Minute:").pack(side=LEFT)
        self.minute = IntVar()
        self.minute.set(self.clock.getMinute())
        Entry(frame, textvariable=self.minute, width=2).pack(side=LEFT)

        Label(frame, text="Second:").pack(side=LEFT)
        self.second = IntVar()
        self.second.set(self.clock.getSecond())
        Entry(frame, textvariable=self.second, width=2).pack(side=LEFT)

        Button(frame, text="Set New Time",
               command=self.setNewTime).pack(side=LEFT)
        Button(frame, text="QUIT", fg="red",
               command=self.closeWindow).pack(side=LEFT)
        self.clock.walk()

        self.window.mainloop()
示例#5
0
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)
from tkinter import *  # Import tkinter
from StillClock import StillClock

window = Tk()  # Create a window
window.title("Display Clocks")  # Set title

clock1 = StillClock(window)
clock1.grid(row=1, column=1)

clock2 = StillClock(window)
clock2.grid(row=1, column=2)

clock3 = StillClock(window)
clock3.grid(row=1, column=3)

clock4 = StillClock(window)
clock4.grid(row=1, column=4)

window.mainloop()  # Create an event loop