子类化Widget或ScrollView时的Kivy Segmentation Fault

时间:2018-02-20 17:08:57

标签: python segmentation-fault kivy

所以我有这个非常简单的kivy脚本:

import kivy
from kivy.app import App, runTouchApp
from kivy.uix.widget import Widget
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.scrollview import ScrollView

class ScrollText(ScrollView): 
    def __init__(self):
         pass

lay = FloatLayout()
st = ScrollText()
lay.add_widget(st)

runTouchApp(lay)

由于某些原因,我在运行时总是遇到分段错误。我已经尝试交换ScrollView for Widget,我尝试使用App()。run()而不是runTouchApp,但问题仍然存在。以下是运行应用程序时的控制台输出:

(env) user@DEV-20:~/workarea$ python3 scrltxt.py
[INFO   ] [Logger      ] Record log in /home/user/.kivy/logs/kivy_18-02-20_30.txt
[INFO   ] [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609]
[INFO   ] [Factory     ] 194 symbols loaded
[DEBUG  ] [Cache       ] register <kv.lang> with limit=None, timeout=None
[DEBUG  ] [Cache       ] register <kv.image> with limit=None, timeout=60
[DEBUG  ] [Cache       ] register <kv.atlas> with limit=None, timeout=None
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[DEBUG  ] [Cache       ] register <kv.texture> with limit=1000, timeout=60
[DEBUG  ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600
[DEBUG  ] [Window      ] Ignored <egl_rpi> (import error)
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[DEBUG  ] [GL          ] glShaderBinary is not available
[INFO   ] [GL          ] Backend used <gl>
[INFO   ] [GL          ] OpenGL version <b'3.0 Mesa 17.2.8'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel Open Source Technology Center'>
[INFO   ] [GL          ] OpenGL renderer <b'Mesa DRI Intel(R) HD Graphics 630 (Kaby Lake GT2) '>
[INFO   ] [GL          ] OpenGL parsed version: 3, 0
[INFO   ] [GL          ] Shading version <b'1.30'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[DEBUG  ] [Shader      ] Fragment compiled successfully
[DEBUG  ] [Shader      ] Vertex compiled successfully
[DEBUG  ] [ImageSDL2   ] Load </home/user/workarea/env/lib/python3.5/site-packages/kivy/data/glsl/default.png>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
Segmentation fault (core dumped)

你能复制这个问题吗?我有不同的方法来创建Scrollable文本框吗?这对我的环境有问题吗?

1 个答案:

答案 0 :(得分:0)

我没有实例化超类。补充:

ScrollView.__init__(self)