callback
callback(global_name: Callable[…, Any] | str | None = None, name: str | None = None) -> Callable[…, Any]Use the callback decorator to mark a method as a callback that can be invoked from the Slint component.
For the decorator to work, the method must be a member of a class that is Slint component.
Example:
import slint
class AppMainWindow(slint.loader.main_window.MainWindow):
# Automatically connected to a callback button_clicked() # in main_window.slint's MainWindow. @slint.callback() def button_clicked(self): print("Button clicked")
...python
If your Python method has a different name from the Slint component’s callback, use the name parameter to specify
the correct name. Similarly, use the global_name parameter to specify the name of the correct global singleton in
the Slint component.
Note: The callback decorator can also be used with async functions. They will be run as task in the asyncio event loop. This is only supported for callbacks that don’t return any value, and requires Python >= 3.13.
© 2026 SixtyFPS GmbH