How to change the font size of the power table using script

I want to use scripting to dynamic change the font size for a power table。

Below is the scripting under Extention Function of configureCell of this power table. I created a custom property named "Status" for this power table, and I want use this property to dynamic change the font size. But seems it doesn't work.

Anyone can help give me some advise? where is the problem.

def configureCell(self, value, textValue, selected, rowIndex, colIndex, colName, rowView, colView):
    if self.Status == 'expand':
    	return {'font': Font("Dialog", 24)}
    elif self.Status == 'collapse':
		return {'font': Font("Dialog", 32)}
    else:
        pass

Issue detail as below:

In 'expand' status:

In 'collapse' status:

The property of status is changed by a button script, but the font does not change accordingly.

I'm not sure if there are other problems with your script, but first of all, it does not look like you imported Font

from java.awt import Font
2 Likes

Yes, I forgot add this import, I will add it to see if it works. Thank you!

After I add import line,I found I still need add the Font.PLAIN, then this script works well.
The final code will like as below:

def configureCell(self, value, textValue, selected, rowIndex, colIndex, colName, rowView, colView):
    from java.awt import Font
    if self.Status == 'expand':
    	return {'font': Font("Dialog", Font.PLAIN, 24)}
    elif self.Status == 'collapse':
		return {'font': Font("Dialog", Font.PLAIN, 32)}
    else:
        pass

in 'expand' status:

in 'collapse' status:

1 Like