Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/vboxcolor.py
blob: 8c663253e920e8a5c1e6c251922472cd447db26e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import GObject
from gi.repository import Gtk


# Class for a colored VBox
class VBoxColor(Gtk.VBox):
	
	def __init__(self, color, homogeneous=False, spacing=0):
		"Set up the vbox"
		super(VBoxColor, self).__init__(homogeneous, spacing)
		self.connect("expose-event", self.expose)
		self.color = color
		

	def expose(self, widget, event):
		"Draw the background"
		gc = widget.window.cairo_create()      
		gc.set_source_rgb(*self.color)
		gc.rectangle(event.area.x, event.area.y, event.area.width, event.area.height)
		gc.fill()