Skip to content

Instantly share code, notes, and snippets.

@amalgamatedclyde
Created December 28, 2013 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalgamatedclyde/8163247 to your computer and use it in GitHub Desktop.
Save amalgamatedclyde/8163247 to your computer and use it in GitHub Desktop.
i did not write this code. it was a demo posted somewhere
import kivy
kivy.require('1.8.0')
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.camera import Camera
from kivy.uix.button import Button
from kivy.core.window import Window
class MyApp(App):
# Function to take a screenshot
def doscreenshot(self,*largs):
Window.screenshot(name='screenshot%(counter)04d.jpg')
def build(self):
camwidget = Widget() #Create a camera Widget
cam = Camera() #Get the camera
cam=Camera(resolution=(640,480), size=(500,500))
cam.play=True #Start the camera
camwidget.add_widget(cam)
button=Button(text='screenshot',size_hint=(0.12,0.12))
button.bind(on_press=self.doscreenshot)
camwidget.add_widget(button) #Add button to Camera Widget
return camwidget
if __name__ == '__main__':
MyApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment