Qu

pptx.add_shape

Builtin index · File I/O

pptx.add_shape(p, i, kind, x=, y=, w=, h=, [fill=], [stroke=], [stroke_width=1.5], [dash=], [radius=], [text=], [size=], [bold=], [italic=], [color=], [font=], [align="center"], [name=])

Input: p, i, kind, x, y, w, h, fill, stroke, stroke_width, dash, radius, text, size, bold, italic, color, font, align, name · Output: no output

What it is

Adds a shape to slide i and returns its id. kind is "rect", "ellipse" ("oval") or "rounded_rect" -- placed by x, y, w, h -- or "line" / "arrow" (an arrowhead at the end), placed from (x=, y=) to (x2=, y2=) with only stroke=, stroke_width=, dash= and name= besides. Positions are millimetres from the top-left corner or lengths. fill= and stroke= take a colour name or #rrggbb, or "none"; the default is Qu's palette blue with no outline (an unfilled shape and every line get a dark outline, or they would be invisible). stroke_width is in points, dash is "solid", "dash", "dot" or "dashdot", radius (rounded rectangles) is the corner as a fraction of the shorter side, 0 to 0.5. text= puts text inside (newlines start paragraphs; size, bold, italic, color, font, align format it; the colour defaults to black or white, whichever reads on the fill). Colours are written explicitly rather than taken from the theme, so the shape looks the same in any deck. Nothing on the master, the layouts or the slide's animation timing is touched. *Added in v0.4.7*

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
pptx.add_shape(p, i, kind, x=, y=, w=, h=, [fill=], [stroke=], [stroke_width=1.5], [dash=], [radius=], [text=], [size=], [bold=], [italic=], [color=], [font=], [align="center"], [name=])
p —not documented yet
i —Adds a shape to slide i and returns its id.
kind —kind is "rect", "ellipse" ("oval") or "rounded_rect" -- placed by x, y, w, h -- or "line" / "arrow" (an arrowhead at the end), placed from (x=, y=) to (x2=, y2=) with only stroke=, stroke_width=, dash= and name= besides.
x —kind is "rect", "ellipse" ("oval") or "rounded_rect" -- placed by x, y, w, h -- or "line" / "arrow" (an arrowhead at the end), placed from (x=, y=) to (x2=, y2=) with only stroke=, stroke_width=, dash= and name= besides.
y —kind is "rect", "ellipse" ("oval") or "rounded_rect" -- placed by x, y, w, h -- or "line" / "arrow" (an arrowhead at the end), placed from (x=, y=) to (x2=, y2=) with only stroke=, stroke_width=, dash= and name= besides.
w —kind is "rect", "ellipse" ("oval") or "rounded_rect" -- placed by x, y, w, h -- or "line" / "arrow" (an arrowhead at the end), placed from (x=, y=) to (x2=, y2=) with only stroke=, stroke_width=, dash= and name= besides.
h —kind is "rect", "ellipse" ("oval") or "rounded_rect" -- placed by x, y, w, h -- or "line" / "arrow" (an arrowhead at the end), placed from (x=, y=) to (x2=, y2=) with only stroke=, stroke_width=, dash= and name= besides.
fill optionalfill= and stroke= take a colour name or #rrggbb, or "none".
stroke optionalkind is "rect", "ellipse" ("oval") or "rounded_rect" -- placed by x, y, w, h -- or "line" / "arrow" (an arrowhead at the end), placed from (x=, y=) to (x2=, y2=) with only stroke=, stroke_width=, dash= and name= besides.
stroke_width optional (default 1.5)stroke_width is in points, dash is "solid", "dash", "dot" or "dashdot", radius (rounded rectangles) is the corner as a fraction of the shorter side, 0 to 0.5.
dash optionalkind is "rect", "ellipse" ("oval") or "rounded_rect" -- placed by x, y, w, h -- or "line" / "arrow" (an arrowhead at the end), placed from (x=, y=) to (x2=, y2=) with only stroke=, stroke_width=, dash= and name= besides.
radius optionalstroke_width is in points, dash is "solid", "dash", "dot" or "dashdot", radius (rounded rectangles) is the corner as a fraction of the shorter side, 0 to 0.5.
text optionaltext= puts text inside (newlines start paragraphs.
size optionalsize, bold, italic, color, font, align format it.
bold optionalsize, bold, italic, color, font, align format it.
italic optionalsize, bold, italic, color, font, align format it.
color optionalsize, bold, italic, color, font, align format it.
font optionalsize, bold, italic, color, font, align format it.
align optional (default "center")size, bold, italic, color, font, align format it.
name optionalkind is "rect", "ellipse" ("oval") or "rounded_rect" -- placed by x, y, w, h -- or "line" / "arrow" (an arrowhead at the end), placed from (x=, y=) to (x2=, y2=) with only stroke=, stroke_width=, dash= and name= besides.
not documented yetPositions are millimetres from the top-left corner or lengths. Colours are written explicitly rather than taken from the theme, so the shape looks the same in any deck. Nothing on the master, the layouts or the slide's animation timing is touched. *Added in v0.4.7*.

Examples

No documentation example calls this form yet. The File I/O chapter is where one belongs.