Skip to content

How to connect signals from another node? #72

Answered by niklas2902
GuiSaiUwU asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,
I'm sorry to hear that.
I quickly went over it. It seems, for callable to be valid, you kind of have to use the methods new1 or new2 for construction. So you have to point to a method of a gdclass:

file_dialog.connect(StringName.new2("file_selected"), Callable.new2(self, StringName.new2("_on_file_dialog_file_selected")))

I don't know your specific use case. But there is a bit of a simpler way for add. I added the signals as properties of the classes and you can connect them directly (keep in mind, the method you want to connect to has to be a gdclass):

file_dialog.file_selected.connect(self._on_file_dialog_file_selected)

here is my full example code:

from py4godot.methods import private

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by GuiSaiUwU
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants