View Single Post
daperl's Avatar
Posts: 2,427 | Thanked: 2,986 times | Joined on Dec 2007
#135
Originally Posted by Bundyo View Post
Just try to make a window transparent
Well, I think I see what they're doing. They must be keeping a pixbuf moving window that they're updating first thing on move events; the windows move slow and the ghosting seems a bit heavy. My hack below shows a white transparency over the screen just to the left of the dialog. So, I know I'm not far off. Also, they must be using a shape bitmap mask for the non-rectangular applets, which most likely is supported by the X server. Maybe I'll play more later; I haven't done my taxes yet.

Code:
#! /usr/bin/env python

import gtk

class awindow(gtk.Window):
    def __init__(s):
        gtk.Window.__init__(s)
        s.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
        s.connect('destroy', gtk.main_quit)
        #rw = s.get_root_window()
        rw = gtk.gdk.get_default_root_window()
        pbd = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, 80, 80)
        pbt = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, 80, 80)
        pbt.fill(0xffffffff)
        pb = pbd.get_from_drawable(rw, rw.get_colormap(), 360, 180, 0, 0, 80, 80)
        pbt.composite(pb, 0, 0, 80, 80, 0, 0, 1.0, 1.0, gtk.gdk.INTERP_NEAREST, 150)
        b = gtk.Button('Press Me')
        b.connect('clicked', s.on_clicked)
        s.i = gtk.image_new_from_pixbuf(pb)
        vb = gtk.VBox(False, 0)
        vb.add(s.i)
        vb.add(b)
        s.add(vb)
        s.show_all()

    def on_clicked(s, b):
        print 'inside'
        #rw = s.get_root_window()
        rw = gtk.gdk.get_default_root_window()
        pbd = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, 80, 80)
        pbt = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, 80, 80)
        pbt.fill(0xffffffff)
        x, y = s.window.get_origin()
        a = s.i.get_allocation()
        print 'x y ax ay',x,y,a.x,a.y
        sx = x + a.x
        sy = y + a.y
        pb = pbd.get_from_drawable(rw, rw.get_colormap(), sx-90, sy, 0, 0, 80, 80)
        pbt.composite(pb, 0, 0, 80, 80, 0, 0, 1.0, 1.0, gtk.gdk.INTERP_NEAREST, 150)
        s.i.set_from_pixbuf(pb)
        s.show_all()

if __name__ == "__main__":
    w = awindow()
    gtk.main()
__________________
N9: Go white or go home
 

The Following User Says Thank You to daperl For This Useful Post: