Skip to content

Instantly share code, notes, and snippets.

@snegovick snegovick/gtkgst_dialog.py
Last active Aug 29, 2015

Embed
What would you like to do?
Example GTK-GST dialog
try:
import gtk
import gobject
from gtk import gdk
except:
raise SystemExit
import pygtk
if gtk.pygtk_version < (2, 0):
print "PyGtk 2.0 or later required for this widget"
raise SystemExit
import gtkgst
class Dialog:
def __init__(self):
d = gtk.Dialog()
d.add_buttons(gtk.STOCK_CANCEL, 1)
camera = gtkgst.GtkGst("/dev/video0", [320, 240])
d.vbox.pack_start(camera)
capture = gtk.Button("Snap")
self.image = None
def capture_cb(*kwargs):
self.image = camera.take_snapshot()
get_code.set_sensitive(True)
capture.set_sensitive(False)
print "capture"
capture.connect("clicked", capture_cb, None)
d.vbox.pack_start(capture)
d.show_all()
ret = d.run()
d.destroy()
if __name__=="__main__":
d = Dialog()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.