From dcc258823b75b62d59034a02e8c607e42c9b0680 Mon Sep 17 00:00:00 2001 From: Cristhofer Travieso Date: Sat, 19 Oct 2013 18:43:21 +0000 Subject: Fixing bugs Signed-off-by: Cristhofer Travieso --- diff --git a/game.py b/game.py index b31d08e..90018ec 100644 --- a/game.py +++ b/game.py @@ -25,10 +25,6 @@ import random WIDTH = 1200 HEIGHT = 700 -OPPONENT_CARDS = [None, None, None] -MY_CARDS = [None, None, None] -CARDS = [] - class Eventbox(Gtk.EventBox): def __init__(self): Gtk.EventBox.__init__(self) @@ -119,14 +115,19 @@ class Box(Gtk.VBox): self.opponent_box.pack_start(card3, True, True, 0) def _click(self, widget): + children = self.play_box.get_children() + if len(children) > 2: + self.play_box.remove(children[-1]) + self.play_box.remove(children[-2]) + self.my_box.remove(widget) self.play_box.pack_start(widget, True, False, 0) -if __name__ == "__main__": - window = Gtk.Window() - window.connect('destroy', lambda w: Gtk.main_quit()) - window.add(Eventbox()) - window.maximize() - window.set_title('Truco') - window.show() - Gtk.main() + self.opponent_box.remove(random.choice(self.opponent_box.get_children())) + + img = Gtk.Image() + c = random.choice(self.cards[3: 5]) + img.set_from_file('icons/cards/' + c + '.svg') + self.play_box.pack_start(img, True, False, 0) + img.show() + diff --git a/window.py b/window.py index c7a1c64..c7a1c64 100644..100755 --- a/window.py +++ b/window.py -- cgit v0.9.1