diff options
author | Cristhofer Travieso <cristhofert97@gmail.com> | 2013-10-19 18:43:21 (GMT) |
---|---|---|
committer | Cristhofer Travieso <cristhofert97@gmail.com> | 2013-10-19 18:43:21 (GMT) |
commit | dcc258823b75b62d59034a02e8c607e42c9b0680 (patch) | |
tree | 38a1790438a2da27435c8e51baa85b25f2b21b03 | |
parent | da77631ed7bbad8d4179aa41984ca64a023387df (diff) |
Signed-off-by: Cristhofer Travieso <cristhofert97@gmail.com>
-rw-r--r-- | game.py | 25 | ||||
-rwxr-xr-x[-rw-r--r--] | window.py | 0 |
2 files changed, 13 insertions, 12 deletions
@@ -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() + |