I've been trying really hard to create a window with no decoration and a transparent background using PyGTK. I would then draw the content of the window with Cairo. But I can't get it to work.
I've tried a lot of different ways, they all failed, this is one of them
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk, sys, cairo
win = None
def expose (widget, event):
cr = widget.window.cairo_create()
#Start drawing
cr.set_operator(cairo.OPERATOR_CLEAR)
cr.set_source_rgba(0.5,1.0,0.0,0.5)
cr.rectangle(0, 0, 0.9, 0.8)
cr.fill()
def main (argc):
global win
win = gtk.Window()
win.set_decorated(False)
win.connect('delete_event', gtk.main_quit)
win.connect('expose-event', expose)
win.set_app_paintable(True)
win.show()
gtk.main()
if __name__ == '__main__':
sys.exit(main(sys.argv))
So, what is the simplest way to do this?