Comments (9)
Seconded. This would be an extremely helpful feature.
from python-pptx.
I have python code that generates connector shapes. If it would help you with this library, I can send you a copy.
from python-pptx.
Sure, want to fork and then send a pull request? I'll be happy to take a look :)
from python-pptx.
Checking on this one as we need to be able to draw a polygon on a slide (Outlining areas of a picture) and I don't see a way to do this without it.
Thanks!
from python-pptx.
If a normal-ish polygon will do the trick, you could pick a suitable AutoShape (rectangle, circle, pentagon, etc.) and set its fill to no-fill and set its outline color and width to suit. That would certainly be a lot less work that forming it from individual lines. Note that with adjustment handles you can exercise quite a bit of control over shapes that have them.
Lines/connectors are not on the immediate roadmap, although they are relatively high up in the backlog sequence/priority.
from python-pptx.
Something like this will work
from pptx import Presentation
from pptx.util import *
from lxml import objectify
from pptx.oxml.ns import nsdecls
title_only_slide_layout = prs.slide_layouts[5]
slide = prs.slides.add_slide(title_only_slide_layout)
shapes = slide.shapes
self._add_line_sp(shapes,2284189,1701577,0,3959671)
def _add_line_sp(self,shapes, x, y, cx, cy):
line_tmpl = """
<p:sp %s>
<p:nvSpPr>
<p:cNvPr id="%s" name="%s"/>
<p:cNvSpPr>
<a:spLocks noChangeShapeType="1"/>
</p:cNvSpPr>
<p:nvPr/>
</p:nvSpPr>
<p:spPr bwMode="auto">
<a:xfrm>
<a:off x="%s" y="%s"/>
<a:ext cx="%s" cy="%s"/>
</a:xfrm>
<a:prstGeom prst="line">
<a:avLst/>
</a:prstGeom>
<a:noFill/>
<a:ln w="25560" cap="sq">
<a:solidFill>
<a:srgbClr val="0000FF"/>
</a:solidFill>
<a:round/>
<a:headEnd type="triangle" w="med" len="med"/>
<a:tailEnd type="triangle" w="med" len="med"/>
</a:ln>
</p:spPr>
</p:sp>
""" % (nsdecls('p', 'a'), '%d', '%s', '%d', '%d', '%d', '%d')
id_ = shapes._next_shape_id
name = 'Line %d' % (id_-1)
#x = 2284189
#y = 1701577
#cx = 0
#cy = 3959671
line_xml = line_tmpl %(id_, name, x, y, cx, cy)
line_obj = objectify.fromstring(line_xml)
shapes._spTree.append(line_obj)
from python-pptx.
@scanny @thomasysliu are you interested in working on this? I'd be interested in funding it. We have a requirement for loading a networkx json file into a .pptx slide showing nodes and edges. The nodes would be images/icons provided by references in the JSON.
from python-pptx.
@johnrfrank Yes, we have a mechanism for sponsored features. If you contact me at the email on my profile page https://github.com/scanny if you like and we can set up a quick call.
from python-pptx.
Added in release v0.6.1 on Oct 9, 2016.
from python-pptx.
Related Issues (20)
- Save Slide as Image HOT 2
- Local PDF to PowerPoint Converter with LLM Summarization
- Is it possible to add support for "/select,file:///..." URIs? HOT 3
- Convert PPTX slide to Image HOT 1
- How to embed an .h3d (Hyperworks output file) file? HOT 3
- Line char None values
- How to set shink in sharp when text box overflow in Python pptx HOT 1
- Fit shape to text?
- Hide a shape HOT 2
- ValueError: value must be in range 256 to 2147483647 inclusive, got 2147483648 - when adding slide HOT 13
- MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE attribute does not take effect HOT 4
- Removing video results in corrupted file. HOT 6
- Create multiple slides with concurrent.futures HOT 1
- run function on click HOT 1
- How to access and create media objects HOT 7
- copying slide-masters HOT 1
- Make xlsxwriter an optional dependency HOT 4
- There is a bug for load image under the package "langchain.document_loaders import UnstructuredImageLoader" HOT 1
- Add OLE shapes
- auto_size not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-pptx.