:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Signal.xml. .. _class_Signal: Signal ====== Class representing a signal defined in an object. Tutorials --------- - :doc:`Using Signals <../getting_started/step_by_step/signals>` - `GDScript Basics <../tutorials/scripting/gdscript/gdscript_basics.html#signals>`__ Constructors ------------ +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Signal` | :ref:`Signal` **(** **)** | +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Signal` | :ref:`Signal` **(** :ref:`Signal` from **)** | +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Signal` | :ref:`Signal` **(** :ref:`Object` object, :ref:`StringName` signal **)** | +-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ Methods ------- +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`connect` **(** :ref:`Callable` callable, :ref:`int` flags=0 **)** | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`disconnect` **(** :ref:`Callable` callable **)** | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`emit` **(** ... **)** |vararg| |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_connections` **(** **)** |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | :ref:`StringName` | :ref:`get_name` **(** **)** |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`get_object` **(** **)** |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_object_id` **(** **)** |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_connected` **(** :ref:`Callable` callable **)** |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_null` **(** **)** |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ Operators --------- +-------------------------+--------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`operator !=` **(** :ref:`Signal` right **)** | +-------------------------+--------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`operator ==` **(** :ref:`Signal` right **)** | +-------------------------+--------------------------------------------------------------------------------------------------+ Constructor Descriptions ------------------------ .. _class_Signal_constructor_Signal: - :ref:`Signal` **Signal** **(** **)** Constructs a null ``Signal`` with no object nor signal name bound. ---- - :ref:`Signal` **Signal** **(** :ref:`Signal` from **)** Constructs a ``Signal`` as a copy of the given ``Signal``. ---- - :ref:`Signal` **Signal** **(** :ref:`Object` object, :ref:`StringName` signal **)** Creates a new ``Signal`` with the name ``signal`` in the specified ``object``. Method Descriptions ------------------- .. _class_Signal_method_connect: - :ref:`int` **connect** **(** :ref:`Callable` callable, :ref:`int` flags=0 **)** Connects this signal to the specified :ref:`Callable`, optionally providing connection flags. You can provide additional arguments to the connected method call by using :ref:`Callable.bind`. :: for button in $Buttons.get_children(): button.pressed.connect(on_pressed.bind(button)) func on_pressed(button): print(button.name, " was pressed") ---- .. _class_Signal_method_disconnect: - void **disconnect** **(** :ref:`Callable` callable **)** Disconnects this signal from the specified :ref:`Callable`. ---- .. _class_Signal_method_emit: - void **emit** **(** ... **)** |vararg| |const| Emits this signal to all connected objects. ---- .. _class_Signal_method_get_connections: - :ref:`Array` **get_connections** **(** **)** |const| Returns the list of :ref:`Callable`\ s connected to this signal. ---- .. _class_Signal_method_get_name: - :ref:`StringName` **get_name** **(** **)** |const| Returns the name of this signal. ---- .. _class_Signal_method_get_object: - :ref:`Object` **get_object** **(** **)** |const| Returns the object emitting this signal. ---- .. _class_Signal_method_get_object_id: - :ref:`int` **get_object_id** **(** **)** |const| Returns the ID of the object emitting this signal (see :ref:`Object.get_instance_id`). ---- .. _class_Signal_method_is_connected: - :ref:`bool` **is_connected** **(** :ref:`Callable` callable **)** |const| Returns ``true`` if the specified :ref:`Callable` is connected to this signal. ---- .. _class_Signal_method_is_null: - :ref:`bool` **is_null** **(** **)** |const| Operator Descriptions --------------------- .. _class_Signal_operator_neq_bool: - :ref:`bool` **operator !=** **(** :ref:`Signal` right **)** ---- .. _class_Signal_operator_eq_bool: - :ref:`bool` **operator ==** **(** :ref:`Signal` right **)** .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`