Grasshopper

algorithmic modeling for Rhino

Change font-size of [panel component] using python

Hi,

I want to change some properties of all component panel connected to an output:

Here I can change the colour of panels easily:

But when I try to change font-size and some other properties, I get this error:

"can't assign to read-only property Size of type 'Font'"

Is there anyway to change these properties of a panel through python?

Views: 1203

Attachments:

Replies to This Discussion

you have to create a new font to assign it. try this:

import System
for output in ghenv.Component.Params.Output[1].Recipients:
if output.Name == "Panel":
currFont = output.Properties.Font
font = System.Drawing.Font(currFont.Name,size)
output.Properties.Font = font

Thank you so much, It works perfect.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service