Created
July 11, 2013 05:40
-
-
Save amirkheirabadi73/5972804 to your computer and use it in GitHub Desktop.
Screenshot From Cammera
This file contains hidden or 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
import kivy | |
kivy.require('1.4.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