Skip to content

Commit 129316a

Browse files
committed
refactor: update shape dimensions to use tuple format for improved readability
1 parent 786018f commit 129316a

File tree

2 files changed

+586
-588
lines changed

2 files changed

+586
-588
lines changed

examples/add_shape_example.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
from pathlib import Path
44

5-
from pptx.enum.shapes import MSO_AUTO_SHAPE_TYPE
6-
from pptx.util import Inches
7-
85
import tppt
6+
from pptx.enum.shapes import MSO_AUTO_SHAPE_TYPE
97

108

119
def main():
@@ -19,32 +17,32 @@ def main():
1917
shape.fill.solid().fore_color.set_rgb("#0066ff"),
2018
shape.set_text("Sample Box with Text"),
2119
)[-1],
22-
left=Inches(1),
23-
top=Inches(1),
24-
width=Inches(4),
25-
height=Inches(2),
20+
left=(1, "in"),
21+
top=(1, "in"),
22+
width=(4, "in"),
23+
height=(2, "in"),
2624
)
2725
.add_shape(
2826
MSO_AUTO_SHAPE_TYPE.ROUNDED_RECTANGLE,
2927
lambda shape: (
3028
shape.fill.solid().fore_color.set_rgb("#ff6600"),
3129
shape.set_text("Rounded Box"),
3230
)[-1],
33-
left=Inches(6),
34-
top=Inches(1),
35-
width=Inches(3),
36-
height=Inches(1.5),
31+
left=(6, "in"),
32+
top=(1, "in"),
33+
width=(3, "in"),
34+
height=(1.5, "in"),
3735
)
3836
.add_shape(
3937
MSO_AUTO_SHAPE_TYPE.OVAL,
4038
lambda shape: (
4139
shape.fill.solid().fore_color.set_rgb("#00ff00"),
4240
shape.set_text("Circle"),
4341
)[-1],
44-
left=Inches(1),
45-
top=Inches(4),
46-
width=Inches(2),
47-
height=Inches(2),
42+
left=(1, "in"),
43+
top=(4, "in"),
44+
width=(2, "in"),
45+
height=(2, "in"),
4846
)
4947
).save(Path(__file__).with_suffix(".pptx"))
5048

0 commit comments

Comments
 (0)