Last active
December 23, 2015 13:29
-
-
Save cclauss/6642429 to your computer and use it in GitHub Desktop.
Display the clipboard text at full screen resolution... Show a message to your friends... Show the taxi driver your desired address... Have fun.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Display the current clipboard text in full screen mode | |
import clipboard, console, scene | |
clipText = clipboard.get() | |
if not clipText: | |
clipText = """Hang up your cellphone and drive your car!!!""" | |
zclipText = """Please take me home...""" | |
class MyScene(scene.Scene): | |
def setup(self): | |
(imageName, imageSize) = self.getImageNameAndSize() | |
theRect = scene.Rect(0, 0, *imageSize) | |
theRect.center(self.bounds.center()) | |
print(theRect), ; print(self.bounds) | |
self.add_layer(scene.Layer(theRect)) | |
self.root_layer.image = imageName | |
def getImageNameAndSize(self): | |
for fontSize in xrange(256, 31, -32): | |
(imageName, imageSize) = scene.render_text(clipText, font_size=fontSize) | |
print(fontSize), ; print(imageSize), ; print(self.bounds) | |
if scene.Point(*imageSize) in self.bounds: | |
return (imageName, imageSize) | |
scene.unload_image(imageName) | |
return scene.render_text(clipText, font_size=12) | |
def draw(self): | |
#scene.background(0, 0, 0) | |
self.root_layer.update(self.dt) | |
self.root_layer.draw() | |
def touch_began(self, touch): pass | |
def touch_moved(self, touch): pass | |
def touch_ended(self, touch): pass | |
scene.run(MyScene(), orientation=scene.LANDSCAPE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment