-
How do you communicate between Screens? I have a main Screen pushed by the app that contains a TextLog. I tried the following:
On the screen that sends the log message:
On the main screen:
The TextLog has id "log". But nothing appears on the Log The only workaround I have found is to use self.app.post_message and put the on_log_message method into the App. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You may find that the answer I gave in #2559 will be helpful with this too. To directly answer the question here though: the best thing to do is to post the message to the screen or widget that is interested in it; don't post it to the screen that's about the be popped. So something more like: self.app.screen.post_message(LogMessage("Logged Out"))
self.app.pop_screen() As it is though, the callback system mentioned in the other similar question you asked is likely going to be a more satisfying approach. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answer, was able to work things out thanks to it! |
Beta Was this translation helpful? Give feedback.
You may find that the answer I gave in #2559 will be helpful with this too.
To directly answer the question here though: the best thing to do is to post the message to the screen or widget that is interested in it; don't post it to the screen that's about the be popped. So something more like:
As it is though, the callback system mentioned in the other similar question you asked is likely going to be a more satisfying approach.