diff options
-rw-r--r-- | game.py | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -41,7 +41,7 @@ class Canvas(Gtk.DrawingArea): GObject.GObject.__init__(self) self.cars = [] - self.routes = [(10, 50)] + self.routes = [(10, "horizontal"), (200, "vertical")] self.connect('draw', self._draw_cb) @@ -57,8 +57,19 @@ class Canvas(Gtk.DrawingArea): #Draw route for route in self.routes: - x, w = route - context.rectangle(x, 0, w, self.alloc.height) + pos, address = route + if address == "horizontal": + x = pos + y = 0 + w = 50 + h = self.alloc.height + else: + x = 0 + y = pos + w = self.alloc.width + h = 50 + + context.rectangle(x, y, w, h) context.set_source_rgb(0.2, 0.2, 0.2) context.fill() |