[Python-es] trabajo con gtk de python en pc cliente

aaaliaga en grm.uci.cu aaaliaga en grm.uci.cu
Vie Jun 1 21:41:56 CEST 2012


Hola a todos sucede que estoy tirando mi código en gtk el cual les  
pongo a continuación:

********************************************************
class icarus_pantallazo:
     def main(self):
         root = gtk.gdk.get_default_root_window();
         rootwidth, rootheight = root.get_size();
         current_dt=datetime.datetime.now()
         dia_numero= "%02d" % current_dt.day
         meses_numero="%02d" % current_dt.month
         anio=str(current_dt.year)
         hora_24="%02d" % current_dt.hour
         minuto="%02d" % current_dt.minute
         segundo="%02d" % current_dt.second
          
self.fecha=dia_numero+"-"+meses_numero+"-"+anio+"_"+hora_24+":"+minuto+":"+segundo
         #
         self.pix = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 1, 8,  
rootwidth, rootheight);
         self.pix.get_from_drawable(root, root.get_colormap(), 0, 0,  
0, 0, rootwidth, rootheight);

     def destruir(self,widget, data="None"):
         gtk.main_quit()
     def guardar(self,modo):
         if modo==1:
             #crear ventana para tomar el recuadro
             self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
             self.window.set_decorated(True)
             self.window.connect("destroy", self.destruir)
             self.window.set_events(self.window.get_events() |  
gtk.gdk.BUTTON_PRESS_MASK)
             self.window.connect("button_press_event", self.press_aplication)
             self.window.show()

             pixmap, mask =  
gtk.gdk.pixmap_create_from_xpm_d(self.window.window, None, data)
             self.image = gtk.Image()
             self.image.set_from_pixmap(pixmap, mask)
             self.image.show()

             # To display the image, we use a fixed widget to place the image
             self.fixed = gtk.Fixed()
             self.fixed.set_size_request(50,50) #16,16
             self.fixed.put(self.image, 0, 0)
             self.window.add(self.fixed)
             self.fixed.show()
             self.window.shape_combine_mask(mask, 0, 0)
             gtk.main()
             #
         if self.pix!=None:
             dir_foto=dir_completa+self.fecha+".png"
             self.pix.save(dir_foto, "png")
             lista.append(dir_foto)
             return 0
         return 1
     def press_aplication(self, widget, event):
         #print event
         if event.x<=16 and event.y<=16 and event.button==1:
             dimension=self.window.get_size()
             posicion=self.window.get_position()
             pix_aux = self.pix.subpixbuf(posicion[0],posicion[1],  
dimension[0], dimension[1])
             self.pix=pix_aux
             self.window.hide()
             gtk.main_quit()
             #self.pix=None
         return 0

     def close_application(self, widget, event, data=None):
         gtk.main_quit()
         self.pix=None
         #del self.window
         return gtk.FALSE
**********************************************************
El objetivo que pretendo es crear una ventana para realizar una  
selección en un determinado link de la aplicación
pero al encontrarmen en una pc cliente en la que navego por la  
aplicación que se encunetra corriendo en un servidor de prueba con  
django, ocurre que la ventana sale en la pc servidor y no en la pc  
cliente cuando en realidad se ha dado click en la pc cliente. Si  
alguién pudiera orientarme cómo resolver el problema para que salga en  
la pc que se a ejecutado la acción me sería de mucha ayuda, de esto  
depende una tesis.




Más información sobre la lista de distribución Python-es