IIRC opecv starts a mainloop when create window is called. In general, don't use threads unless you have read the FAQ and understand what you are doing.
John 2012/2/21 Joseph S. Alcântara <josephser...@gmail.com>: > Even if I don't use, ie, if I comment the lines where NamedWindow, ShowImage > and WaitKey appear it freezes too. > > Joseph Soares Alcântara > Engenharia da Computação - 8º semestre > Universidade Federal do Ceará - UFC > Sobral - Ceará > > +--------------------------------------------------------------------------+ > .| - °v°...A liberdade não pode ser comprada e sim | > .| -/(_)\..conquistada. Conquiste a sua também use | > .| - ^^ G N U / L I N U X | > +--------------------------------------------------------------------------+ > > > > 2012/2/21 John Stowers <john.stowers.li...@gmail.com> >> >> GTK is not threadsafe. >> >> If opencv shows a gtk mainwindow in cv.ShowImage, and that occurs in a >> different thread to the one running gtk_main, then unpredictable >> crashes and odd behaviour will result. >> >> Please check the pygtk FAQ for how to use threading and pygtk. >> >> I suggest displaying the image yourself in by getting the data from >> the IPL image and copying it into a GtkImage. Or be much more careful >> with which operations you do in which thread (i.e. cv.ShowImage, >> cv.WaitKey) >> >> John >> >> 2012/2/21 Joseph S. Alcântara <josephser...@gmail.com>: >> > Hi, Thank you for response to me. >> > >> > See, can I sand you my program to you see what I am making? I've used >> > Thread, but seems like is not working like I want. >> > >> > You must run from main.py >> > >> > Joseph Soares Alcântara >> > Engenharia da Computação - 8º semestre >> > Universidade Federal do Ceará - UFC >> > Sobral - Ceará >> > >> > >> > +--------------------------------------------------------------------------+ >> > .| - °v°...A liberdade não pode ser comprada e sim | >> > .| -/(_)\..conquistada. Conquiste a sua também use | >> > .| - ^^ G N U / L I N U X | >> > >> > +--------------------------------------------------------------------------+ >> > >> > >> > >> > 2012/2/19 Hart's Antler <bhart...@yahoo.com> >> >> >> >> Hi Joseph, >> >> I got GTK and OpenCV working together using threads. This example >> >> works >> >> with CPython2, CPython3 and PyPy, see my blog post. >> >> http://pyppet.blogspot.com/2011/12/rpythonic-044.html >> >> >> >> -brett- >> >> >> >> ________________________________ >> >> From: Joseph S. Alcântara <josephser...@gmail.com> >> >> To: pygtk@daa.com.au >> >> Sent: Sunday, February 19, 2012 9:46 AM >> >> Subject: [pygtk] PyGTK + OpenCV >> >> >> >> hi, I'm writing a application that uses pygtk and opencv. and I had a >> >> problem. When I run the program it shows a gui. So far so good. But, >> >> when I >> >> click in a menuitem, it should call a functino that runs the famous >> >> routine >> >> to show a video from webcam. But in this moment, the app freezes. I >> >> have >> >> tried to use thread, but opencv gui runs just after I call >> >> gtk.main_quit(). >> >> What could solve my problem? Thanks. >> >> >> >> Estou escrevendo um programa em python, usando pygtk e opencv. Quando >> >> rodo >> >> o programa, aparece uma janela e até aí, beleza. Mas quando eu clico em >> >> um >> >> menuitem, ele deve chamar uma função que roda a famosa rotina que exibe >> >> um >> >> vídeo a partir da webcam. No entanto, neste momento, o programa trava. >> >> Então, eu tentei usar Thread, mas a parte do opencv só roda depois que >> >> eu >> >> fecho a janela, chamando gtk.main_quit(). O que poderia ser? Obrigado >> >> desde >> >> já. >> >> >> >> Joseph Soares Alcântara >> >> Engenharia da Computação - 8º semestre >> >> Universidade Federal do Ceará - UFC >> >> Sobral - Ceará >> >> >> >> >> >> >> >> +--------------------------------------------------------------------------+ >> >> .| - °v°...A liberdade não pode ser comprada e sim | >> >> .| -/(_)\..conquistada. Conquiste a sua também use | >> >> .| - ^^ G N U / L I N U X | >> >> >> >> >> >> +--------------------------------------------------------------------------+ >> >> >> >> >> >> _______________________________________________ >> >> pygtk mailing list pygtk@daa.com.au >> >> http://www.daa.com.au/mailman/listinfo/pygtk >> >> Read the PyGTK FAQ: http://faq.pygtk.org/ >> >> >> > >> > >> > _______________________________________________ >> > pygtk mailing list pygtk@daa.com.au >> > http://www.daa.com.au/mailman/listinfo/pygtk >> > Read the PyGTK FAQ: http://faq.pygtk.org/ > > _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/