reportlab borderRadius不工作

2024-10-04 09:20:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用的是ReportLab3.2和Python2.7。 我试着把一些文本放在一个圆形的面板上,像这样: enter image description here

但我得到了: enter image description here 我尝试过使用borderRadius,但它无法使拐角变圆:

ps_title2 = ParagraphStyle(styles['Normal'],\
    fontName=helper.REG_FONT, fontSize=18, textColor=DARK_BLUE,\
    leading=22, backColor=LIGHT_BLUE, borderRadius=15)

pr2 = Paragraph('Interpretation summary<br/>something<br/>another thing', ps_title2)
pr2 = Paragraph('my paragraph<br/>something<br/>another thing', ps_title2)
elements.append(pr2)

我知道另一种方法是使用表格,知道如何制作表格,将信息放在表格中,但不知道如何使表格的角变圆。 画画布不是一个好主意,因为我不知道该节的坐标,因为它会根据内容的长度而改变。 有什么办法让拐角变圆吗?在


Tags: 文本branotherblue圆形something表格ps
1条回答
网友
1楼 · 发布于 2024-10-04 09:20:58

我查看了代码,发现当未设置border color时,border radius将不起作用;还需要设置borderWidth和borderPadding。 以下是有效的方法:

ps_title2 = ParagraphStyle(styles['Normal'],\
    fontName=helper.REG_FONT, fontSize=18, textColor=DARK_BLUE,\
    leading=22, backColor=LIGHT_BLUE, borderRadius=15, borderColor=LIGHT_BLUE,  borderWidth=1, borderPadding=5)

相关问题 更多 >