Skip to content

Instantly share code, notes, and snippets.

@yaki29
Created February 8, 2017 15:39
Show Gist options
  • Save yaki29/1669bc46c2b65f83a96ec68b3898a1d4 to your computer and use it in GitHub Desktop.
Save yaki29/1669bc46c2b65f83a96ec68b3898a1d4 to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from kivy.uix.popup import Popup
import libxml2
Builder.load_string('''
<PopupScreen>:
orientation: 'vertical'
Button:
text: "Show Story"
on_press: root.detail()
size_hint_y: None
height: '40dp'
ScrollView:
Label:
id: story
font_size: 20
text_size: self.width, None
size_hint_y: None
height: self.texture_size[1]
''')
class PopupScreen(BoxLayout):
def detail(self):
DOC = """<?xml version="1.0" encoding="UTF-8"?>
<verse>
<attribution>Christopher Okibgo</attribution>
<line>For he was a shrub among the poplars,</line>
<line>Needing more roots</line>
<line>More sap to grow to sunlight,</line>
<line>Thirsting for sunlight</line>
</verse>
"""
doc = libxml2.parseDoc(DOC)
root = doc.children
# print root
lbl = self.ids.story
lbl.text = str(root)
doc.freeDoc()
class MovieApp(App):
def build(self):
return PopupScreen()
MovieApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment