Czy rozumiesz ten impas?

Używam wxPython do mojego GUI. wAppLogic klasa Mam wątek roboczy, który jest uruchamiany w metodzie tej klasy.

To jestGUI klasa:

<code>class GUI:
    _wx_app = None
    _main_window = None
    _app_logic = None

    def start(self):
        # bla bla bla
        self._main_window.Show()
        self._app_logic.begin()
        self._wx_app.MainLoop()

    def _cancel_listener(self):
        """Called from MainWindow, if the user has clicked the cancel
        button."""
        print("I'm leaving this scope.")
        self._app_logic.cancel()  # Should cancel the task done in
                                  # a second thread.

    def _status_listener(self, status_text):
        """Called often by the worker thread."""
        print("Here I am again.")
        if self._main_window.status.GetLabel() != status_text:
            self._main_window.status.SetLabel(status_text)
</code>

Oto metoda anulowania zAppLogic klasa, która jest wywoływana przez_cancel_listener z góry:

<code>    def cancel(self):
        self._shall_abort = True
        self._thread.join(self._some_time_out)
        assert self._thread.isAlive() == False
</code>

Jakoś istnieje impasjoin iGetLabel (a zatemMainLoop?) zaangażowany, ale tak naprawdę nie rozumiem, co się dzieje. Czy ktoś ma w tym lepszy wgląd? Byłoby świetnie!

questionAnswers(2)

yourAnswerToTheQuestion