-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwxVidCap.py
executable file
·79 lines (66 loc) · 2.5 KB
/
wxVidCap.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Wed Sep 1 13:15:36 2010
import wx
from wxueye.wxVidWindow import wxVidWindow
from wxueye.wxVidConfig import wxVidConfig
import ueye
# begin wxGlade: extracode
# end wxGlade
class wxVidFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: wxVidFrame.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.vidWindow = wxVidWindow(self, -1)
self.button_1 = wx.ToggleButton(self, -1, u"Visualización")
self.button_2 = wx.Button(self, -1, "Capturar imagen")
self.btnConfig = wx.Button(self, -1, "Configurar")
self.button_4 = wx.Button(self, -1, "Seleccionar Camara")
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_TOGGLEBUTTON, self.OnRunningVid, self.button_1)
self.Bind(wx.EVT_BUTTON, self.OnConfig, self.btnConfig)
# end wxGlade
def __set_properties(self):
# begin wxGlade: wxVidFrame.__set_properties
self.SetTitle("Visualizador de Camaras")
self.vidWindow.SetMinSize((400,400))
# end wxGlade
def __do_layout(self):
# begin wxGlade: wxVidFrame.__do_layout
sizer_3 = wx.BoxSizer(wx.VERTICAL)
sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
sizer_3.Add(self.vidWindow, 1, wx.EXPAND, 0)
sizer_4.Add(self.button_1, 0, 0, 0)
sizer_4.Add(self.button_2, 0, 0, 0)
sizer_4.Add(self.btnConfig, 0, 0, 0)
sizer_4.Add(self.button_4, 0, 0, 0)
sizer_3.Add(sizer_4, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
self.SetSizer(sizer_3)
sizer_3.Fit(self)
self.Layout()
# end wxGlade
def OnRunningVid(self, event): # wxGlade: wxVidFrame.<event_handler>
"""Start and stop video preview """
if self.button_1.GetValue():
self.vidWindow.StartLiveVideo()
else:
self.vidWindow.StopLiveVideo()
event.Skip()
def OnConfig(self, event): # wxGlade: wxVidFrame.<event_handler>
dlg=wxVidConfig(self,cam=self.vidWindow.cam)
dlg.ShowModal()
dlg.Destroy()
event.Skip()
# end of class wxVidFrame
cam=ueye.Cam() # Get the first available cam
cam.SetColorMode (ueye.CM_BGR8_PACKED)
if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
vidframe = wxVidFrame(None, -1, "")
vidframe.vidWindow.cam=cam
app.SetTopWindow(vidframe)
vidframe.Show()
app.MainLoop()