愿与您一同,用代码提升效率!

日常报告截图前,一般都会调整曲线图表头字体大小,图片数量较多时候,每个表头都点击调整一次浪费大量时间,还不能保证每次设置的字体大小相同,使用二次开发脚本1秒搞定。
此篇是学会怎样在hyperview中使用二次开发功能自动调整曲线表头字体大小。
def modify_Header_font (headerlabel,fontsize,fontstyle,fontfamily):# 模块导入 import hw import hw.hg as hg#========================# 依据RGB值 创建color #======================== color = hw.Color(rgb=(255,0,0))#========================# 创建字体#======================== font = hw.Font(size=fontsize,style=fontstyle,family=fontfamily)# ses = hw.Session() win = ses.get(hw.Window) header = ses.get(hg.Header)# 设置名子 header.text = str(headerlabel)# 设置header 位置left, right, center header.alignment = "center"# 设置字体和颜色 header.fontPrimary = font header.color =color# 显示标题 True or False header.visibility = True win.update()modify_Header_font("B-Pillar-ACC",30,"bold","Noto Sans")💡提示
如有问题,欢迎留言指正与交流。 本文已收录进合集,进入文末合集可查看更多笔记。