LoginSignup
3
0

More than 5 years have passed since last update.

RPI上のPythonでKivyを終わらせる

Last updated at Posted at 2018-02-03

RPI+PythonでKivyを動かしているとき、App.get_running_app().stop()で終わってくれない状況の話です。

主ループでClock eventを使い、sys.exit()を呼べば死んでくれるらしいが、KivyをThreadで動かしていて
sys.exit()が使えない場合どうするか。普通のThreadの終わらせ方のように、while flag: みたいにしたいが
Kivyは、buildメソッドをrunすると主ループがプログラマーには見えず、ループに細工できない。
Eventハンドリングのループに直接作用させて、

from kivy.base import EventLoop
...
EventLoop.exit()

で、消えてくれます。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0