I'm trying to pass in a list of arguments to function if the variable is not empty.
Here's the variable:
shape_properties: {
'header_shape': {
'width': 8582400,
'height': 468000
},
'chart_shape': {
'width': 8582400,
'height': 3585600
}}
But this variable could be None sometimes:
shape_properties=None
I would like to pull in the arguements from shape_properties if its not empty. Here is what I tried:
sub_title_shp = add_textbox(slide,
text=question_label,
**shape_properties['header_shape'] if shape_properties else '')
I get this error:
TypeError: add_textbox() argument after ** must be a mapping, not unicode
The error code suggests to me that I cannot use **args in condition like this?
Here is what add_textbox() looks like:
def add_textbox(
sld, text,
left=Emu(0), top=Emu(0), width=Emu(300), height=Emu(100),
font_name="Calibri",
font_size=12,
font_bold=True,
font_italic=False,
font_color=(89,89,89),
font_color_brightness=0,
font_color_theme=None,
word_wrap=True,
auto_size=None,
fit_text=True,
font_file=None,
margin_left=0.25,
margin_right=0.25,
margin_top=0.13,
margin_bottom=0.13,
vertical_alignment='top',
horizontal_alignment='left',
textbox_fill_solid=False,
textbox_color=(100,0,0),
textbox_color_brightness=0,
):