python简易小时钟

python 复制代码
import time
import turtle


def getTime():
    tt = time.localtime()  # 结构化的时间
    ss = time.strftime('%Y年%m月%d日 %H:%M:%S', tt)
    return ss


pen = turtle.Turtle()

pen.backward(100)
pen.speed(0)

while True:
    time.sleep(1)
    times = getTime()
    pen.clear()
    pen.write(times, font=("Arial", 40, "normal"))

input()

效果

相关推荐
geovindu12 分钟前
python: KNeighborsClassifier K
开发语言·后端·python·算法
mattleeee15 分钟前
Python脚本超时重试机制设计:失败立即重试,最多3次
python·超时·重试机制
笨鸟先飞的橘猫27 分钟前
SLG 后端实战(一):基础建模与行军模拟
python·游戏程序
Thanks_ks2 小时前
接口限流是怎么实现的:从固定窗口计数讲到滑动窗口日志
redis·python·限流·滑动窗口·漏桶·令牌桶·固定窗口
时间的情敌2 小时前
Three.js 射线拾取进阶:hover 高亮、点击弹窗、多物体过滤、穿透拾取
开发语言·javascript·three.js
Amumu121382 小时前
TypeScript学习: 基本类型(一)
开发语言·前端·typescript
choicesages3 小时前
跑通不等于跑对:公开评论抓取里三处不报错的坐标问题
爬虫·python·数据清洗·数据质量·去重
敲上瘾3 小时前
Qt 常用控件:按钮、显示输入、容器与布局等
开发语言·c++·qt·qt6.3
船神丿男人4 小时前
C++ STL 入门:用 std::string 读配置,四个容易漏掉的边界
开发语言·c++
鲸渔4 小时前
【AI Agent系列课程33-FastAPI 基础07】自动文档与接口调试:Swagger UI 和 ReDoc 入门
python·ui·fastapi·ai编程