--
To unsubscribe, send email to wxPython-user...@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
import cv
cv.NamedWindow("camera", 1)
capture = cv.CaptureFromCAM(0)
while True:
img = cv.QueryFrame(capture)
cv.ShowImage("camera", img)
if cv.WaitKey(10) == 27:
break
--
To unsubscribe, send email to wxPython-user...@googlegroups.com
I attached two samples that work for me in linux.
One using OpenCV a modified version of one posted here in this thread.
The other using gstreamer
Both seems to works OK with wxPython 2.8.11.0 (gtk2-unicode) on Ubuntu 10.10
Sorry if this is out of context, but I didn't follow this thread very close.
But I think sample code is always welcome ;)
Ricardo
> On a side note, I'm having an issue with all webcam capture methods. I
> get the error "the wx.app object must be created first". Seems to only
> happen when launching the application for the second time in IDLE. No
> problems from command prompt or launching for the first time in IDLE.
> Anyone know how to remedy this problem? Occurred on Windows 7 x64 with
> wxPython 2.8.11.0. Thanks
Either use an IDE that always runs the launched programs and the shell
in external processes (not in the same process as the IDE) or find a way
to make IDLE do that. (I seem to recall that there was a branch of IDLE
development that had that option, and it has since been merged into the
trunk, but I don't remember any more details.) There can only be one
wx.App in a process, and creating new ones after the first has exited
can sometimes be problematic.
--
Robin Dunn
Software Craftsman
http://wxPython.org
... There can only be one wx.App in a process, and creating new ones after the first has exited can sometimes be problematic.
Robin Dunn
Normally the "main thread" in any context is the one that is active when
a program is started, before the program creates any new threads for
itself. The OS is aware of this but as far as the wx UI is concerned it
doesn't really care. OTOH wx does care about which thread it should
consider to be the main thread, but it doesn't have to be the same one
that was created for the process by the system before stating the
program, (but it usually is.) Whichever thread creates the wx.App
object will be the one that wx treats as the main thread.
> Because this is true for threads is it true for processes?
No. Processes are totally isolated from each other by the system
(except for any IPC that they do for themselves of course.)
> Is the first
> process the main process? Or is it unlike threads in that every process
> is "the main process", all processes are equal in the eyes of Python and
> wxPython, they're all the same. I'm thinking the later to be the case.
> In either case would this be a bad (or even doable) [not withstanding
> syntax or proper parameterization] solution to OP's issue:
Theoretically it should be possible to have more than one process in a
process group to have a wx UI, but each of them would have to create a
wx.App and run MainLoop(), and I suppose that it's possible that that
may interfere with the IPC that the subprocess module is using for the
processes to communicate with each other.
... Whichever thread creates the wx.App object will be the one that wx treats as the main thread.
Theoretically it should be possible to have more than one process in a process group
...to have a wx UI, but each of them would have to create a wx.App and run MainLoop(),
...and I suppose that it's possible that that may interfere with the IPC that the subprocess module is using for the processes to communicate with each other.
It does not have to be the same Python module, but it does have to be
the same OS process and the same thread in that process.
--
To unsubscribe, send email to wxPython-user...@googlegroups.com