Skip to content

Commit

Permalink
add an hello world example
Browse files Browse the repository at this point in the history
  • Loading branch information
tito committed Jul 18, 2011
1 parent 79996d6 commit 505ddd2
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
Binary file added examples/helloworld/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/helloworld/kivy-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions examples/helloworld/presentation.kv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env kary
#:kivy 1.0

Slides:

SlideContent:
title: 'Hello world'
content:
('This is the first line\n',
'This is the second line')

SlideImage:
title: 'Test an image'
source: 'kivy-icon.png'

SlideContent:
title: 'My last slide'
content: ('Any questions ?', )

80 changes: 80 additions & 0 deletions examples/helloworld/templates.kv
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#:kivy 1.0

# Little background
<SlidesBackground>:
canvas:
Color:
rgb: 1, 1, 1
Rectangle:
source: 'background.png'
pos: self.pos
size: self.size

# Foreground for displaying a subtitle of the presentation
# + current slide number + total slide number
<SlidesForeground>:
GridLayout:
pos: root.pos
rows: 1
size_hint_y: None
height: 35
canvas:
Color:
rgba: 0, 0, 0, .2
Rectangle:
pos: self.pos
size: self.size
Color:
rgba: 1, 1, 1, .1
Rectangle:
pos: self.x, self.y + 34
size: self.width * float(root.slides.scroll_x), 2
Label:
text: 'My presentation'
Label:
text: '%d / %d' % (root.slides.index + 1, root.slides.max_index)

#
# Templates
#

# Title template for creating an "header" title
[Title@Label]:
text: ctx.text
text_size: self.width - 60, None
halign: 'left'
size_hint_y: None
height: 100
font_size: 36
canvas.before:
Color:
rgba: 0, 0, 0, .2
Rectangle:
pos: self.pos
size: self.size

# Template for displaying a title + content
[SlideContent@Slide]:
GridLayout:
pos: root.pos
cols: 1
Title:
text: ctx.title
BoxLayout:
padding: 50
Label:
text: ''.join(ctx.content)
font_size: ctx.get('font_size', 36)
text_size: self.width, None

# Template for displaying a title + image
[SlideImage@Slide]:
GridLayout:
pos: root.pos
cols: 1
Title:
text: ctx.title
BoxLayout:
padding: 50
Image:
source: ctx.source

0 comments on commit 505ddd2

Please sign in to comment.