共享一个PPT计时器

最近deepseek特别火,我们应用他做PPT已经非常简单了。但是PPT做得好,讲的好才能达到汇报的效果。这里分享一个高手做的PPT计时器的python代码,能帮助大家能更好的掌控自己讲解PPT的时间。

Python程序代码

实际上就是用代码做了一个mp4格式的视频文件,然后插入到PPT文件里面。代码如下:

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
from matplotlib import pyplot as plt
from matplotlib.animation import FuncAnimation

total_time = 30a
alert_time = 10

REPEAT = 100

fig, ax = plt.subplots(1, 1, figsize=(6, 2.5))
plt.axis("off")
plt.tight_layout()

t = ax.text(0.5, 0.5, f"{total_time//60:02d}:{total_time % 60:02d}",
verticalalignment="center",
horizontalalignment="center",
fontdict={"fontsize": 125, "color": "k",
"family": "sans-serif", "weight": "bold"})

def animate(i):
k = i // REPEAT
t.set_text(f"{(total_time - k) // 60:02d}:{(total_time - k) % 60:02d}")
if (total_time - k) <= alert_time:
t.set_color("r" if k % 2 == 0 else "k")

ani = FuncAnimation(fig, animate, range(1, (total_time + 1) * REPEAT),
interval=1000 // REPEAT, repeat=False)

plt.show()
ani.save("countdown.mp4", dpi=100)

PPT内效果
-------------本文结束感谢您的阅读-------------
请我一杯咖啡吧!
郭志良 微信 微信
郭志良 支付宝 支付宝
欢迎关注我的其它发布渠道