首页 > 编程知识 正文

python 怎么设置背景为黑色,tkinter背景色设置

时间:2023-05-05 19:34:00 阅读:59536 作者:584

给想知道的人举个例子吧from docx导入文档

from docx.shared import Inches

from docx.enum.tableimportwd _ align _ vertical

from docx.enum.tableimportwd _ table _ alignment

from docx.enum.styleimportwd _ style

from docx.dml.color import殷勤的大门/pfromdocx.enum.dmlimportmso _ color _ type

from docx.enum.textimportwd _ color _ index

from docx.enum.textimportwd _ color

from docx.shared import Pt

from docx.oxml.ns import nsdecls

from docx.oxml import parse_xml

文档=文档(

document.add _ heading (' document title ',0 ) )。

table=document.add_table () 1,11 ) ) ) ) ) )。

table.style='Table Grid '

table.cell (0,1 ).merge (table.cell ) ) 0,4 ) )

table.cell (0,6 ).merge (table.cell ) 0,7 ) )

table.cell (0,9 ).merge (table.cell ) 0,10 ) )

table.cell (0,0 ).paragraphs[0].add_run ) ' name ' ).bold=True

table.cell (0,5 ).paragraphs[0].add_run ) ' offset ' ).bold=True

table.cell (0,1 ).paragraphs[0].add_run('5566 ) ) ) ) ) ) )。

table.cell (0,6 ).Paragraphs).add_run ) ' neverdie ' () ) ) ) ) ) ) ) )。

table.cell (0,9 ).paragraphs[0].add_run ) '1) ) ) ) ) ) ) )。

forIinrange(11 ) :

table.cell(0,I ).paragraphs [0].alignment=wd _ align _ vertical.center

shading _ elm=parse _ XML (r '.format ) nsdecls('w ' ) )

#shading must create every time

table.cell(0,I ) () ) ) )。

文档. add _ page _ break (

文档. save (demo2. docx ) )。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。