#!/usr/bin/env python

import cairo, gi
from gi.repository import Gtk, Gdk

gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')

class MyWin (Gtk.Window):
    def __init__(self):
        super(MyWin, self).__init__()
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_border_width(30)
        self.screen = self.get_screen()
        self.visual = self.screen.get_rgba_visual()
        if self.visual != None and self.screen.is_composited():
            print ("yay")
            self.set_visual(self.visual)

        box = Gtk.Box()
        btn1 = Gtk.Button(label="foo")
        box.add(btn1)
        self.add(box)

        self.set_app_paintable(True)
        self.connect("draw", self.area_draw)
        self.show_all()

    def area_draw(self, widget, cr):
        cr.set_source_rgba(.2, .2, .2, 0.9)
        cr.set_operator(cairo.OPERATOR_SOURCE)
        cr.paint()
        cr.set_operator(cairo.OPERATOR_OVER)

MyWin()
Gtk.main()
5d1ee4b50e15e8e062fc5d695891f1ba67b367fe
<mask token>


class MyWin(Gtk.Window):
    <mask token>
    <mask token>


<mask token>

<mask token>


class MyWin(Gtk.Window):

    def __init__(self):
        super(MyWin, self).__init__()
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_border_width(30)
        self.screen = self.get_screen()
        self.visual = self.screen.get_rgba_visual()
        if self.visual != None and self.screen.is_composited():
            print('yay')
            self.set_visual(self.visual)
        box = Gtk.Box()
        btn1 = Gtk.Button(label='foo')
        box.add(btn1)
        self.add(box)
        self.set_app_paintable(True)
        self.connect('draw', self.area_draw)
        self.show_all()

    def area_draw(self, widget, cr):
        cr.set_source_rgba(0.2, 0.2, 0.2, 0.9)
        cr.set_operator(cairo.OPERATOR_SOURCE)
        cr.paint()
        cr.set_operator(cairo.OPERATOR_OVER)


<mask token>

<mask token>
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')


class MyWin(Gtk.Window):

    def __init__(self):
        super(MyWin, self).__init__()
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_border_width(30)
        self.screen = self.get_screen()
        self.visual = self.screen.get_rgba_visual()
        if self.visual != None and self.screen.is_composited():
            print('yay')
            self.set_visual(self.visual)
        box = Gtk.Box()
        btn1 = Gtk.Button(label='foo')
        box.add(btn1)
        self.add(box)
        self.set_app_paintable(True)
        self.connect('draw', self.area_draw)
        self.show_all()

    def area_draw(self, widget, cr):
        cr.set_source_rgba(0.2, 0.2, 0.2, 0.9)
        cr.set_operator(cairo.OPERATOR_SOURCE)
        cr.paint()
        cr.set_operator(cairo.OPERATOR_OVER)


MyWin()
Gtk.main()

import cairo, gi
from gi.repository import Gtk, Gdk
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')


class MyWin(Gtk.Window):

    def __init__(self):
        super(MyWin, self).__init__()
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_border_width(30)
        self.screen = self.get_screen()
        self.visual = self.screen.get_rgba_visual()
        if self.visual != None and self.screen.is_composited():
            print('yay')
            self.set_visual(self.visual)
        box = Gtk.Box()
        btn1 = Gtk.Button(label='foo')
        box.add(btn1)
        self.add(box)
        self.set_app_paintable(True)
        self.connect('draw', self.area_draw)
        self.show_all()

    def area_draw(self, widget, cr):
        cr.set_source_rgba(0.2, 0.2, 0.2, 0.9)
        cr.set_operator(cairo.OPERATOR_SOURCE)
        cr.paint()
        cr.set_operator(cairo.OPERATOR_OVER)


MyWin()
Gtk.main()

#!/usr/bin/env python

import cairo, gi
from gi.repository import Gtk, Gdk

gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')

class MyWin (Gtk.Window):
    def __init__(self):
        super(MyWin, self).__init__()
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_border_width(30)
        self.screen = self.get_screen()
        self.visual = self.screen.get_rgba_visual()
        if self.visual != None and self.screen.is_composited():
            print ("yay")
            self.set_visual(self.visual)

        box = Gtk.Box()
        btn1 = Gtk.Button(label="foo")
        box.add(btn1)
        self.add(box)

        self.set_app_paintable(True)
        self.connect("draw", self.area_draw)
        self.show_all()

    def area_draw(self, widget, cr):
        cr.set_source_rgba(.2, .2, .2, 0.9)
        cr.set_operator(cairo.OPERATOR_SOURCE)
        cr.paint()
        cr.set_operator(cairo.OPERATOR_OVER)

MyWin()
Gtk.main()