python-pptx icon indicating copy to clipboard operation
python-pptx copied to clipboard

Add Screentip to shape

Open Savitha-M-ML opened this issue 7 years ago • 2 comments

Hi, Tried below way to add screentip to shape. Able to add a link but not ScreenTip.

The Hyperlink object shows only below attributes, whereas document says otherwise.

<class 'pptx.action.Hyperlink'>
['ScreenTip', '__class__', '__delattr__', '__dict__', '__doc__', '__format__',
 '__getattribute__', '__hash__', '__init__', '__module__', '__new__',
 '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
 '__str__', '__subclasshook__', '__weakref__', '_element', '_get_or_add_hlink',
 '_hlink', '_hover', '_parent', '_remove_hlink', 'address', 'part']

Snippet of code is:

RED = GREEN = BLUE = 0xA9
shapes = slide.shapes
shape = shapes.add_shape(
    MSO_SHAPE.RECTANGLE, Inches(2.93), Inches(3.10),
    width=Inches(1.86), height=Inches(1.58)
)
shape.text_frame.paragraphs[0].font.size=Pt(9)
shape.text_frame.paragraphs[0].font.color.rgb = RGBColor(0x00, 0x00, 0x00)
fill = shape.fill
fill.solid()
fill.fore_color.rgb = RGBColor(RED, GREEN, BLUE)

shape.click_action.target_slide = prs.slides[-2]
h = shape.click_action.hyperlink
print dir(h)

h.screen_tip = "Go to HelpPage"

thanks,

Savitha-M-ML avatar Aug 08 '18 10:08 Savitha-M-ML

Hi, I won't comment on the missing feature, but could you please use the proper GitHub markup for code? See https://guides.github.com/features/mastering-markdown/

This would make your issue description easier to read and get the grasp out of it.

jbq avatar Aug 08 '18 10:08 jbq

print(hlink.screen_tip) leads to AttributeError: '_Hyperlink' object has no attribute 'screen_tip' Please at least fix the documentation

Mike3285 avatar Jan 19 '24 12:01 Mike3285