forked from Jesus89/wxplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wxplayer.py
45 lines (31 loc) · 1.02 KB
/
wxplayer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jesús Arroyo Torrens <jesus.arroyo@bq.com>'
__license__ = 'GNU General Public License v2 http://www.gnu.org/licenses/gpl2.html'
import wx
from camera import Camera
from video_view import VideoView
class Frame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, size=(640, 480))
self.camera = Camera(1)
self.camera.set_resolution(960, 1280)
self.video_view = VideoView(self, self.capture)
self.video_view.start()
box = wx.BoxSizer(wx.HORIZONTAL)
box.Add(self.video_view, 1, wx.ALL | wx.EXPAND, 0)
self.SetSizer(box)
self.Centre()
self.Bind(wx.EVT_CLOSE, self.on_close)
def capture(self):
return self.camera.capture_image(flush=0)
def on_close(self, event):
self.video_view.stop()
event.Skip()
class MyApp(wx.App):
def OnInit(self):
frame = Frame(None)
frame.Show(True)
return True
app = MyApp(0)
app.MainLoop()