我想知道如何在图形窗口中打印时间(以秒为单位)。我正在尝试制作秒表,并且我在窗口中显示了秒表 png,但是如何在特定区域的窗口中显示时间?
此外,有没有办法像真正的秒表(hh:mm:ss)一样格式化时间,60秒后它增加1分钟?
from graphics import *
import time
def main():
win = GraphWin('Stopwatch', 600, 600)
win.yUp()
#Assigning images
stopWatchImage = Image(Point (300, 300), "stopwatch.png")
startImage = Image(Point (210, 170), "startbutton.png")
stopImage = Image(Point (390, 170), "stopbutton.png")
lapImage = Image(Point (300, 110), "lapbutton.png")
#Drawing images
stopWatchImage.draw(win)
startImage.draw(win)
stopImage.draw(win)
lapImage.draw(win)
main()