I'm just getting started with Kivy programming for Python. I'm having trouble in using the PageLayout. This is my Python Code so far (Python 3.6.2):
import kivy
from kivy.app import App
from kivy.uix.pagelayout import PageLayout
class PageApp(App):
def build(self):
return PageLayout()
paApp = PageApp()
paApp.run()
The Kivy-file (PageApp.kv) has the following content:
<PageLayout>:
canvas:
Color:
rgb: 0, .5, .95
Rectangle:
pos: self.pos
size: self.size
BoxLayout:
orientation: "vertical"
Button:
text: "This is a test button"
size_hint_y: .4
Label:
markup: True
text: "This is a [b]looooong[/b] text... "*100
color: 0, 0, 0, 1
outline_color: 0, 0.5, 0.5, 1
font_size: 30
BoxLayout:
orientation: "vertical"
Label:
markup: True
text: "This is an even [b]looooonger[/b] text... "*100
color: 0, 0, 0, 1
outline_color: 0, 0.5, 0.5, 1
font_size: 30
Button:
text: "This is a second test button"
size_hint_y: .2
Button:
text: "Page 3"
Button:
text: "Page 4"
The result looks like this: Page 1, Page 2 (after swiping)
As is visible from the screenshots, the following problems appear:
- The Labels don't show.
- The background is only partially in the color that I specified in the canvas-settings.
- Most importantly: the page doesn't seem to reset after swiping, leading to the problem that elements from the first page remain on the page when swiping to page 2. Page 3 and 4 seem to work fine, because the buttons take the whole space...
Does anyone know how to fix these issues?