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

lesthack lesthack en gmail.com
Vie Jun 1 21:48:20 CEST 2012


Espera, este pedazo de código esta en el servidor o en el cliente ?

No puedes abrir una ventana gtk en un cliente si el código se ejecuta en el
servidor.

On Fri, Jun 1, 2012 at 2:41 PM, <aaaliaga en grm.uci.cu> wrote:

> 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.
>
>
> ______________________________**_________________
> Python-es mailing list
> Python-es en python.org
> http://mail.python.org/**mailman/listinfo/python-es<http://mail.python.org/mailman/listinfo/python-es>
> FAQ: http://python-es-faq.wikidot.**com/<http://python-es-faq.wikidot.com/>
>



-- 
________________________________________________________

ISC. Jorge Luis Hernández C.
Desarrollador de Software y Tecnologías Libres

Colaborador GNU/Linux Debian México
http://lesthack.com.mx
http://blog.debian.mx/
@lesthack
________________________________________________________
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://mail.python.org/pipermail/python-es/attachments/20120601/517e275f/attachment.html>


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