What do you mean by connection protocol

__deets__ wrote: ↑

Tue Jan 01, 2019 10:07 am

Because you could introduce a countdown object analogous to a star. And then rename the _stars to _things or something. In the beginning you will only create a countdown object. Its update method is then always called with the elapsed time & modified its text item (or removes it and creates a new one). Of course, scene clear may not be used in this case.
Without `scene.clear ()` I can't update the countdown text. How does that work without `scene.clear ()`?

__deets__ wrote: ↑

Tue Jan 01, 2019 10:07 am

When the countdown is up, remove the object from the list of things and insert the stars. To do this, you may have to expand the protocol a little: Update must return whether the object should continue to live or must be removed. And it must be able to return a new list of objects. So you could return a tuple (True, []) in update.
What do you mean by "protocol"?

__deets__ wrote: ↑

Tue Jan 01, 2019 10:07 am

In this way you can also do a StarSpawner, for example, which gradually introduces the stars.

The crucial aspect, however, is that the “engine” remains generic.
By "generic" do you mean that the `_update_all ()` method can update both the countdown and the stars?

__deets__ wrote: ↑

Tue Jan 01, 2019 22:09

Along the way yes, the spawn_stars method should of course give us a countdown object. And usually you collect the objects you want to remove and then do it in one go. In the same way, new ones are only really added at the end & they are only calculated in the next cycle.
Why should the method `spawn_stars ()` be in the `countdown` object? I actually viewed the `graphics_window` object as a flow control that created the objects, added them to the list, updated them continuously, etc. Isn't that so?


@ Sirius3: I implemented your recommendations as well as I could.


Current code (at least the countdown works ):

Code: Select all

greeting
Atalant gates