I need to change the font of a label with a condition
but it seems there is a bug or I am doing it wrong, for example:
from java.awt import Font
nom = event.source.parent.getComponent('ioParamNom')
nom.font = Font('MV boli', Font.ITALIC, 30)
the inital text font is ('Dialog', Font.BOLD, 10)
The font works and the style works but not the size
So I tried changing the Font and the style, always works but it doesn't take the size
I tried testing with button, when I click the button, it runs the code above and I see that the size changes to 30 for a second but comes back to inital 10
I am unable to replicate this behavior. I change the font of a label using your script, and it works perfectly. I even closed the designer and reopened it. It remembered.
What version of ignition are you using? Presently, I'm testing on 8.1.20
It's weird because when I run it in the designer pressing the button play, it works
It doesn't work when I launch it from "Tools->Launch Project->Launch (windowed)"
Yup; you are correct. When I run it outside of the designer in an actual session, there is no noticeable change in size. I wonder if this is because the font automatically changes size proportionally to the label, and in the actual session, the label itself holds its dimensions.
I even set up a style customizer tied to a custom property I called fontSize. When I changed the custom property, it was the same result. The style was applied for a moment, and then, it was immediately overwritten.
Again, the approach worked as expected in the designer, but not in an actual session.