Exemple #1
0
    def _loop(self) -> None:
        while True:
            self._on_net_io()

            if Event.events():
                events = Event.events().copy()
                Event.empty()

                for e in events:
                    if e.target:
                        e.target.on_event(e)
                    else:
                        self.on_event(e)
Exemple #2
0
    def _loop(self) -> None:
        self.paint()

        while True:
            self._check_input()

            if Event.events():
                events = Event.events().copy()
                Event.empty()

                for e in events:
                    if e.type == Event.EXIT:
                        exit()
                    elif e.target:
                        e.target.on_event(e)
                    else:
                        self.on_event(e)

                self.paint()

            OutStream.instance('').write(self._socket)