import time import csoundxo import pygtk pygtk.require('2.0') import gtk import os import random import gobject gtk.gdk.threads_init() #gobject.threads_init() class App: def close_application(self, widget): gtk.main_quit() def __init__(self): self.button = gtk.Button('Label') self.button.connect('clicked', self.press) def press(self, widget, data = None): self.cs = csoundxo.CsoundXOThread() self.cs.setMessageCallback(self.msg) print "COMPILE" self.cs.compile(['tmp2.csd']) print "PLAY" self.cs.play() def msg(self, msg): print "[Cs]:", msg def getRootWidget(self): return self.button if __name__ == "__main__": # window setup window = gtk.Window(gtk.WINDOW_TOPLEVEL) e = App() window.connect("destroy", e.close_application) window.add(e.getRootWidget()) window.set_size_request(400, 300) window.show_all() gtk.main()