Il giorno mer, 06/04/2011 alle 08.00 -0300, Vinicius Massuchetto ha
scritto:
> Hi list!
>
> I think I must be missing some signals concepts here, but I having
> trouble reproducing the following behavior:
>
> 1. Click on a button;
> 2. Hide the current window;
> 3. Run an external script (that will open another program's window);
> 4. Show again the PyGTK window after the external program is closed.
>
> For that, I've tried something like:
>
> class Foo:
>
> def __init__(self):
> self.gladefile = gladefile
> self.gladetree = gtk.glade.XML(self.gladefile, 'some_window')
> self.window = self.gladetree.get_widget('some_window')
> events = { 'on_code_submit_clicked' : self.submit }
> self.gladetree.signal_autoconnect(events)
>
> def submit(self):
> self.window.hide()
> os.system('external_script')
> self.window.show()
>
> What's happening, is that when the button is clicked, it stay pressed,
> then the script runs, and after the external program is closed, the
> window "blinks", being hidden and shown again.
>
> I also tried the "pressed" and "released" signals.
>
> What I can imagine is that the event is being run _during_ the
> _clicked_ event, not after. That's why the window remain opened. I
> couldn't find something like `gtk_signal_connect_after` [1] on the
> glade page [2], that leaves me totally lost about it.
>
There may be cleaner solutions, but the first thing which comes to my
mind is replacing
os.system('external_script')
with
glib.idle_add(os.system, 'external_script')
(and maybe replacing "os.system" with "subprocess.call" - but that's not
pygtk-related).
Pietro
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/