示例#1
0
class DisplayClock:
    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 setNewTime(self):
        self.clock.setHour(self.hour.get())
        self.clock.setMinute(self.minute.get())
        self.clock.setSecond(self.second.get())
class DisplayClock:
    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 setNewTime(self):
        self.clock.setHour(self.hour.get())
        self.clock.setMinute(self.minute.get())
        self.clock.setSecond(self.second.get())
class DisplayClock:
    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 setNewTime(self):
        self.clock.setHour(self.hour.get())
        self.clock.setMinute(self.minute.get())
        self.clock.setSecond(self.second.get())
示例#4
0
class DisplayClock:
    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()

    def setNewTime(self):
        self.clock.setTime(self.hour.get(), self.minute.get(),
                           self.second.get())

    def closeWindow(self):
        self.clock.stopwalk()
        self.window.destroy()
class DisplayClock(object):
	"""docstring for DisplayClock"""
	def __init__(self):
		super(DisplayClock, self).__init__()
		# self.arg = arg
		window=tk.Tk()
		window.title('change clock time')

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

		frame=tk.Frame(window)
		frame.pack()

		tk.Label(frame,text='hour: ').pack(side=tk.LEFT)
		self.hour=tk.IntVar()
		self.hour.set(self.clock.getHour())
		tk.Entry(frame,textvariable=self.hour,width=2).pack(side=tk.LEFT)

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

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

		tk.Button(frame,text='set new time',command=self.setNewTime).pack(side=tk.LEFT)
		window.mainloop()

	def setNewTime(self):
		self.clock.setHour(self.hour.get())
		self.clock.setMinute(self.minute.get())
		self.clock.setSecond(self.second.get())
示例#6
0

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
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