Last active
August 29, 2015 13:56
-
-
Save snegovick/9337476 to your computer and use it in GitHub Desktop.
Example GTK-GST dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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