I am trying to enable and disable the stop button to play sound in a GUI created using Glade PyGTK 2.0.
Basically, the program runs under control and an external process for reproducing sound.
I use multiprocessing (as threads are too slow) and I cannot turn off the stop button. I understand that this is due to the fact that processes cannot access the memory shared by the gtk widget thread.
Am I doing something wrong or is there a way to turn on the button after exiting the process?
#!/usr/bin/python import pygtk import multiprocessing import gobject from subprocess import Popen, PIPE pygtk.require("2.0") import gtk import threading gtk.threads_init() class Foo: def __init__(self):
EDIT: Nothing, I figured it out. I did not implement the threads correctly, and this caused a delay. Now it works great. Just change the FooBar method to:
def FooBar(self,widget): self.stopButton.set_sensitive(True)
source share