GUI Properties#
arcade.gui.DictProperty#
arcade.gui.ListProperty#
arcade.gui.Property#
- class arcade.gui.Property(default=None, default_factory=None)[source]#
An observable property which triggers observers when changed.
- Parameters:
default – Default value which is returned, if no value set before
default_factory – A callable which returns the default value. Will be called with the property and the instance
arcade.gui.bind#
- arcade.gui.bind(instance, property: str, callback)[source]#
Binds a function to the change event of the property. A reference to the function will be kept, so that it will be still invoked, even if it would normally have been garbage collected.
- def log_change():
print(“Something changed”)
- class MyObject:
name = Property()
my_obj = MyObject() bind(my_obj, “name”, log_change)
my_obj.name = “Hans” # > Something changed
- Parameters:
instance – Instance owning the property
property – Name of the property
callback – Function to call
- Returns:
None