Dear all,
I have a problem with the following program. When I push the button
the program shows the dialog window but doesn't show the labels whithin
the dialog. This labels are shown when the sleep(10) function ends.
Why "events_pending" loop doesn't work? What can I do?
------------------------- start
#!/usr/bin/env python
from gtk import *
import time
from gnome.ui import *
#from gnome.xmhtml import *
#from thread import *
#import crypt
#import whrandom
#import string
#import sys
#import posix
#from threading import *
class ClassProgram:
window = GnomeApp('threads.py', 'Thread Test')
window.set_position(WIN_POS_CENTER)
def __init__(self):
print "<:ClassProgram>"
self.mainGui()
def mainGui(self):
self.crea_main_window()
mainloop()
def destroy(self, *args):
mainquit()
def cb_dialog(self, _widget):
dialog = UIDialog()
print "sleeping 10 ..."
time.sleep(10)
dialog.active_button(TRUE)
def crea_main_window(self, *args):
self.window.connect("destroy", self.destroy)
# allow_shrink, allow_grow, auto_shrink
self.window.set_policy(0, 0, 0)
self.window.set_usize(800, 600)
self.window.set_uposition(200, 200)
boton = GtkButton("push me!")
boton.connect("clicked", self.cb_dialog)
self.window.set_contents(boton)
self.window.show()
class UIDialog:
def __init__(self):
print "<:UIDialog>"
win = GtkDialog()
win.set_position (WIN_POS_CENTER)
win.set_policy(FALSE, FALSE, TRUE)
win.set_modal(TRUE)
win.set_title("Dialog")
win.set_usize(400, 350)
win.vbox.set_border_width(5)
win.action_area.set_spacing(30)
self.button = GtkButton("ok")
self.button.connect("clicked", win.destroy)
self.button.set_sensitive(FALSE)
win.action_area.pack_start(self.button)
label1 = GtkLabel("Label 1")
label2 = GtkLabel("Label 3")
win.vbox.pack_start(label1)
win.vbox.pack_start(label2)
win.show_all()
while events_pending():
mainiteration(TRUE)
def active_button(self, bool):
self.button.set_sensitive(bool)
if __name__ == '__main__': ClassProgram()
------------------------ end
_____________________________________________________________________
Horas ilimitadas para leer y enviar correos con Tarifa Plana Wanadoo
�� desde las 3 de la tarde!!
Compru�balo en http://www.wanadoo.es/acceso-internet
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/