def text_style(keys, txt): bold = '1' if 'font-weight' in keys else '0' fill_text_ml = a.solidFill( color(srgbClr=msclr( e.get('fill') if 'fill' in keys else 'black'))) autofit_ml = a.normAutofit(fontScale="62500", lnSpcReduction="20000") # Auto fit font_size = str(int( float(interpret_str(e.get('font-size'))) * 100)) if 'font-size' in keys else '1600' shp.append( p.txBody( a.bodyPr(anchor=txt_anchor(), wrap='none'), a.p( a.pPr(algn=txt_align()), a.r( a.rPr(fill_text_ml, lang='en-US', sz=font_size, b=bold, dirty='0', smtClean='0'), a.t(txt))))) return shp
def text_style(keys, txt): bold = '1' if 'font-weight' in keys else '0' fill_text_ml = a.solidFill(color(srgbClr=msclr(e.get('fill') if 'fill' in keys else 'black'))) autofit_ml = a.normAutofit(fontScale="62500", lnSpcReduction="20000") # Auto fit font_size = str(int(float(interpret_str(e.get('font-size')))*100)) if 'font-size' in keys else '1600' shp.append(p.txBody(a.bodyPr(anchor=txt_anchor(), wrap='none'), a.p(a.pPr(algn=txt_align()), a.r(a.rPr(fill_text_ml, lang='en-US', sz=font_size, b=bold, dirty='0', smtClean='0'), a.t(txt))))) return shp
shapes.append(shp) # Fill with an RGB colour shp.spPr.append(a.gradFill( a.gsLst( a.gs(color(schemeClr='accent2', tint= '0%'), pos="0"), a.gs(color(schemeClr='accent2', tint='20%'), pos="50000"), a.gs(color(schemeClr='accent2', tint='40%'), pos="100000"), ), a.lin(ang='2700000', scaled='1'), # out of 21600000 = 1/8 = 45 degrees )) # Add a line shp.spPr.append(a.ln( a.solidFill(color( # Solid fill with schemeClr='accent2', # 2nd theme colour shade='20%', # 20% black mixed alpha='50%', # 50% transparent )), w='3175', # 0.25pt stroke width )) # Add text shp.append(p.txBody( a.bodyPr(anchor='ctr'), # vertically center the text a.p( a.pPr(algn='ctr'), # horizontally center the text a.r(a.t('abc')), ))) prs.save('sample.pptx')
a.gradFill( a.gsLst( a.gs(color(schemeClr='accent2', tint='0%'), pos="0"), a.gs(color(schemeClr='accent2', tint='20%'), pos="50000"), a.gs(color(schemeClr='accent2', tint='40%'), pos="100000"), ), a.lin(ang='2700000', scaled='1'), # out of 21600000 = 1/8 = 45 degrees )) # Add a line shp.spPr.append( a.ln( a.solidFill( color( # Solid fill with schemeClr='accent2', # 2nd theme colour shade='20%', # 20% black mixed alpha='50%', # 50% transparent )), w='3175', # 0.25pt stroke width )) # Add text shp.append( p.txBody( a.bodyPr(anchor='ctr'), # vertically center the text a.p( a.pPr(algn='ctr'), # horizontally center the text a.r(a.t('abc')), ))) prs.save('sample.pptx')