-
-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delay or after function #1415
Comments
You could try this: App.add_background_task() |
Thanks for the suggestion! As @t-arn noted, you can do this today with
That said - "run this code in N seconds" is a common enough design pattern that it would be worth adding a utility method |
I tried with App.add_background_task(), and It worked perfectly, Text is flashing, I can do also windows changing and all of this staff. This is the source code if it will needed in the future:
Also thanks for your work, I am using Toga like a month, and already love it. keep it up! |
Can I work on this? |
@VahilaK Absolutely! One consideration to keep in mind is that we will want to have a single "run_later" method that can handle any function, generator or coroutine (i.e., we need to be able to handle a simple function, a function that has a You'll also need to add a demonstration case; there is a |
@freakboy3742 I added a function 'run_later' in app.py from toga.core. I updated the handlers demo but when running the handlers example, I get an error "HandlerApp object has no attribute run_later". How can I use the 'run_later' function in handlers example? If that's not possible how can I use the 'run_later' function as part of an example to test out it's functionality. P.S: This seems like a simple workflow but I am not very experienced with python and I am not able to figure it out. I apologize for the inconvenience. |
@VahilaK If you're getting an error that the method that you've added isn't being found, it's probably because you're not using your local (modified) version of Toga to run the app. See this guide for how to set up your environment for testing. |
See related discussion starting at #2099 (comment). |
Since Toga 0.4, the event loop is available as a property on the App object. So this can be done using |
Is your feature request related to a problem? Please describe.
I have been trying to make flashing text with Toga. I can make it using button, when you click the button text will disappear and when you click it again text will appear again. It looks like this:
But I am unable to find the function which will waits, for example, 2 seconds and then runs the flash function. Like the time.sleep(), Or to be more clear and get help from other GUI framework, like the after function from Tkinter.
The solution of my problem in Tkinter: https://stackoverflow.com/questions/27533244/how-to-make-a-flashing-text-box-in-tkinter
Describe the solution you'd like
To solve this problem, I would like to be able to do flashing without button, for example, something like this:
Additional context
Please inform me if there is a solution already. if not, please add this feature in Toga. I planed to do many things using this feature and I would love to see it.
The text was updated successfully, but these errors were encountered: