There are three ways to change properties:
As in zheoffec's answer, use the
set_property()
function (orset_style_property()
for style properties.) This function is actually not necessary in Python, but it is there for completeness because it is part of the C API.Use the
props
attribute. Any property that you find in the documentation can be accessed through this attribute. For example,btn1.props.label = 'StackOverflow'
andbtn1.props.use_underline = False
.Use the getter and setter functions as frb suggests. These are also only present because they are part of the C API, but some people prefer them over the
props
attribute. Also, there is no guarantee that any particular property will have getter and setter functions! Usually in a well-designed C API they will be there, but it is not required.
For style properties, I believe the only option is #1. For "attributes", well, these are simply Python attributes. To access the allocation
attribute, use btn1.allocation
.