Commits

Matthew Turk committed 04a50e3

Adding interactors.

Comments (0)

Files changed (3)

examples/hello_world.py

 import os
 
 from vanhoek.api import \
-    Slide, WhiteSlide, Presentation
+    Slide, WhiteSlide, BlackSlide, Presentation, EnterKeyPresser
 import vanhoek.primitives.api as primitives
 import vanhoek.backends.api as backends
 
     primitives.TextObject("!", (600, 500), (1.0, 0.0, 0.0, 1.0))
 ])
 
+s2 = BlackSlide([
+    primitives.TextObject("Hello", (0, 100), (1.0, 1.0, 1.0, 1.0)),
+    primitives.TextObject("world", (300, 300), (0.0, 1.0, 0.0, 1.0)),
+    primitives.TextObject("!", (600, 500), (1.0, 0.0, 0.0, 1.0))
+])
+
 presentation.append(s1)
+presentation.append(s2)
 
 if not os.path.isdir("output"): os.mkdir("output")
 output = backends.PNGWriter("output/slide_%04i.png")
+output.interactor = EnterKeyPresser()
 presentation.display(output)
-from .slide import Slide, WhiteSlide
+from .slide import Slide, WhiteSlide, BlackSlide
 from .presentation import Presentation
+from .interactors import EnterKeyPresser

vanhoek/backends/backend_base.py

 class BackendBase(object):
     __metaclass__ = abc.ABCMeta
 
+    interactor = None
+
     @abc.abstractmethod
     def draw(self, slide, i):
+        if self.interactor is not None: self.interactor.wait(i)
         surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 1024, 768)
         context = cairo.Context(surface)
         slide.render(context)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.