Commits

Matthew Turk committed 04a50e3

Adding interactors.

  • Participants
  • Parent commits 5e400d3

Comments (0)

Files changed (3)

File 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)

File vanhoek/api.py

-from .slide import Slide, WhiteSlide
+from .slide import Slide, WhiteSlide, BlackSlide
 from .presentation import Presentation
+from .interactors import EnterKeyPresser

File 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)