如何在Python-Pptx中读取AutoShape的颜色?

发布于 2025-02-08 06:15:32 字数 473 浏览 2 评论 0原文

彩色圆圈是Python-Pptx中的AutoShape类型,现在我想阅读

我在文档中获得

shape.fill.solid() 
shape.fill.fore_color.rgb

的颜色(RGB或其他任何内容) ,但它弹出了

AttributeError: no .rgb property on color type '_NoneColor'

任何想法来访问颜色汽车?

(顺便说一句,最好发布颜色变化方法,因为我读了颜色以通过HSV调整来更改它)

enter image description here

Colorful circles are the autoshape type in python-pptx, Now I want to read the color(RGB or whatever) of them

What I got in documentation is use

shape.fill.solid() 
shape.fill.fore_color.rgb

But It pops

AttributeError: no .rgb property on color type '_NoneColor'

Any idea to access the color of autoshape?

(BTW, Best to post the color change method cause I read color for change it by HSV adjustment)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

太阳公公是暖光 2025-02-15 06:15:32

您需要阅读主题/重音颜色。这是一个如何为字体执行此操作的示例,形状

python-pptx 非常相似:阅读字体颜色

You will need to read the theme/accent colour. Here is an example of how to do this for fonts, the process is rather similar for shapes

python-pptx: read font color

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文