Hi,
I wrote a code with python opencv2 and it works fine. I wants to add GUI
Window to my program. So, I tried to attach my code with Pygtk. Its too
works fine. But, opencv cv2.imshow() function not run.

*Actual Code:-*

import pygtk
pygtk.require('2.0')
import gtk
import numpy as np
import cv2

builder = gtk.Builder()
builder.add_from_file("GUI.glade")
window = builder.get_object("window1")
window.set_title("Single Object Tracking")
window.connect("delete-event", gtk.main_quit)
window.show_all()
img = cv2.imread('Birds.jpg')
cv2.imwrite('abcdefgh.png',img)
cv2.imshow('image',img)
cv2.waitKey(10000)
cv2.destroyAllWindows()
gtk.main()


Actually, program does not show any compile time error.  But after execute
this program, when the flow reach that code "cv2.imshow('image',img)"
program automatically terminates. If I comment "cv2.imshow('image',img")
only means this program works fine. But, I need to insert the code
"cv2.imshow('image',img)". Could you please me to solve this problem...

Thanks in advance...
import pygtk
pygtk.require('2.0')
#import gtk

import numpy as np
import cv2

#builder = gtk.Builder()
#builder.add_from_file("GUI.glade")
#window = builder.get_object("window1")
#window.set_title("Single Object Tracking")
#window.connect("delete-event", gtk.main_quit)
#window.show_all()    

img = cv2.imread('Birds.jpg')
cv2.imwrite('abcdefgh.png',img)
cv2.imshow('image',img)
cv2.waitKey(10000)
cv2.destroyAllWindows()

#gtk.main()

Attachment: GUI.glade
Description: application/glade

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to