I take back my speculation from last night; Dino's code did once work, and
it uses yield from. I found the version Dino emailed me privately, cleaned
up the tulip references, added the lambda helper you suggested, and then it
worked. That version is definitely related to the one you checked in, but
also pretty different; I will try to understand the differences and maybe I
can help you. (You also need a Holmes.txt file; this one seems to work:
http://www.gutenberg.org/cache/epub/1661/pg1661.txt.)


On Fri, May 16, 2014 at 9:40 PM, Guido van Rossum <[email protected]> wrote:

> I suspect it never worked, or only with a private variant of Tulip
> developed by Dino and Steve Dower, a long time ago, when Steve was arguing
> for yield instead of yield-from. I believe I have a version in a private
> scratch directory too somewhere. it would be good to revive this for real,
> but It would probably be a pretty big project, and Dino's code would at
> best be useful to glean some tricks from...
>
>
> On Friday, May 16, 2014, Victor Stinner <[email protected]> wrote:
>
>> Hi,
>>
>> Ádám Szieberth contacted me privately to notify me that
>> "asyncio_tkinter" does not work. I host this project in this
>> repository:
>> https://bitbucket.org/haypo/asyncio_staging
>>
>> The code was written by Dino Viehland for a talk, I just updated the
>> code for the new asyncio API (ex: import tulip => import asyncio).
>>
>> Is there anyone interested to fix the code?
>>
>> Adam wrote that the following line in tkapp.py :
>>    self.button["command"] = self.do_count
>>
>> must be replaced with:
>>    self.button["command"] = lambda: asyncio.Task(self.do_count())
>> or
>>    self.button["command"] = functools.partial(asyncio.Task,
>> self.do_count())
>>
>> But it's not enough.
>>
>> guievents.py contains a class which inherits from AbstractEventLoop
>> and I see a lot of private code copied from asyncio, like
>> run_in_executor(). This code uses privates classes like Handle,
>> whereas Handle API has changed.
>>
>> I'm not sure that I understood the design. asyncio event loop and Tk
>> main loop are both running in the same thread? The code uses at least
>> two pools of threads.
>>
>> It looks like the Tk loop must run in the main loop. Why not using a
>> standard asyncio event loop in a dedicated thread with
>> call_soon_threadsafe()?
>>
>> Victor
>>
>
>
> --
> --Guido van Rossum (on iPad)
>



-- 
--Guido van Rossum (python.org/~guido)

Reply via email to