'Kivy: White screen when trying to run a kivy app on Raspberry Pi
I am new with Kivy programming and I am working on a project for my college. I have a Raspberry Pi 2 with a 16Gb SD Card and I have installed Raspbian Jessie and Kivy 1.9.2.
I wrote a simple code which is basically just a screen manager. There are six buttons and every button opens a new screen. (the screens contains just a text and a "back" button at this moment) This kivy app works fine in my computer (windows 7) but when I try to run it with raspberry pi I only get a white empty screen. (I don't have any error message on CLI when I run the app)
I tried some other kivy apps like "showcase" from the examples folder of kivy and it worked fine. I tried to run a lot of examples from kivy and I noticed that some apps work fine and others just give a blank screen. Any ideas? Is there a RAM situation? Thanks!
from kivy.app import App
#kivy.require("1.9.2")
from kivy.lang import Builder
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from glob import glob
from os.path import dirname, join, basename
from kivy.uix.screenmanager import ScreenManager, Screen, WipeTransition
from kivy.uix.label import Label
from kivy.uix.widget import Widget
from kivy.uix.videoplayer import VideoPlayer
from kivy.clock import Clock
from kivy.graphics import Line,Color,Ellipse
class MainScreen(Screen):
pass
class ScreenOne(Screen):
pass
class ScreenTwo(Screen):
pass
class ScreenThree(Screen):
pass
class ScreenFour(Screen):
pass
class ScreenFive(Screen):
pass
class ScreenSix(Screen):
pass
class ScreenManagement(ScreenManager):
pass
presentation = Builder.load_file("Interface4.kv")
class Interface4(App):
def build(self):
return presentation
if __name__ == "__main__":
Interface4().run()
Interface4.kv
#: import WipeTransition kivy.uix.screenmanager.WipeTransition
ScreenManagement:
transition: WipeTransition()
MainScreen:
ScreenOne:
ScreenTwo:
ScreenThree:
ScreenFour:
ScreenFive:
ScreenSix:
Everyone of these screens contains just the basic texts and a "back to previous screen" button. For example.
<ScreenOne>
name: "other1"
orientation: 'vertical'
canvas:
Color:
rgb: 0, 0, 1
Rectangle:
source: 'data/images/background.jpg'
size: self.size
FloatLayout:
Button:
on_release: app.root.current = "main"
background_color: 0,0,1,0
text_size: self.size
font_size: 20
pos_hint: {'x': .85, 'y': .0}
size_hint: .15, .15
Image:
source:'data/images/home.png'
pos:self.parent.pos
size:self.parent.size
Solution 1:[1]
This problem is related to the GPU memory on the Raspberry Pi. You can increase it.
Edit /boot/config.txt
Scroll down until you see gpu_mem and change it as follows:
gpu_mem=256
Then reboot.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mtl Dev |
