[Tkinter-discuss] TKinter and Python asyncio

Bhaskar Chaudhary bha100710 at gmail.com
Mon Dec 18 17:48:12 EST 2017


Hi

Check out this code:
https://github.com/fluentpython/asyncio-tkinter

Download the entire code from above and run tkapp2.py which uses
asyncio with Tkinter - to count frequency of word in a large file -
which freezes the GUI when run linearly but when run with asyncio
handles it without blocking.

Look at the implementation of  method named `do_count` which uses asyncio.

I believe this is from some PyCon talk but I am not sure.

regards
Bhaskar






On 12/19/17, c.buhtz at posteo.jp <c.buhtz at posteo.jp> wrote:
> Dear Bhaskar,
>
> thank you for your answer.
>
> On 2017-12-18 20:37 Bhaskar Chaudhary <bha100710 at gmail.com> wrote:
>> No its not at all a bad idea to combine tkinter with asyncio. Asyncio
>> is a good thing to use whenever you have an  I/O bound task which is
>> likely to take too much time and interfere with the main loop.
>
> I think here is my point. Tkinter has a loop and asyncio has a loop.
> How can I combine this?
> I couldn't finde a Tkinter-asyncio-example on the internet.
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> https://mail.python.org/mailman/listinfo/tkinter-discuss
>


More information about the Tkinter-discuss mailing list