Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristhofer Travieso <cristhofert97@gmail.com>2013-08-27 21:16:33 (GMT)
committer Cristhofer Travieso <cristhofert97@gmail.com>2013-08-27 21:16:33 (GMT)
commit235cb785e0b24e865e7d5997871b75d27b4a6872 (patch)
tree28b0e586dffb2b000cea468628620f7f8fbc46fc
parent98834b9ab7999b5fb660e8e053c7049216aa83c4 (diff)
Add opponent cards and play card
Signed-off-by: Cristhofer Travieso <cristhofert97@gmail.com>
-rw-r--r--game.py65
1 files changed, 38 insertions, 27 deletions
diff --git a/game.py b/game.py
index ad733bf..fba143e 100644
--- a/game.py
+++ b/game.py
@@ -45,54 +45,65 @@ class Box(Gtk.VBox):
self.cards = []
+ #opponent box
self.opponent_box = Gtk.HBox()
- self.add(self.opponent_box)
+ self.pack_start(self.opponent_box, True, True, 0)
+ #play box
self.play_box = Gtk.HBox()
- self.add(self.play_box)
+ self.pack_start(self.play_box, True, True, 0)
+ #my box
self.my_box = Gtk.HBox()
- self.add(self.my_box)
+ self.pack_start(self.my_box, True, True, 0)
self._deal()
- #btn1
+
+
+ def _deal(self):
+
+ num = 0
+ while num < 7:
+ self.cards.append( str(random.randint(1, 12))+ random.choice(['coarse', 'cup', 'gold', 'sword']) )
+ num += 1
+
+ #card1
btn1 = Gtk.Button(self.cards[0])
btn1.connect('clicked', self._click)
- self.my_box.add(btn1)
+ self.my_box.pack_start(btn1, True, True, 0)
- #btn2
+ #card2
btn2 = Gtk.Button(self.cards[1])
btn2.connect('clicked', self._click)
- self.my_box.add(btn2)
+ self.my_box.pack_start(btn2, True, True, 0)
- #btn3
+ #card3
btn3 = Gtk.Button(self.cards[2])
btn3.connect('clicked', self._click)
- self.my_box.add(btn3)
+ self.my_box.pack_start(btn3, True, True, 0)
- def _deal(self):
+ #deck
+ deck = Gtk.Label('|Mazo| ')
+ self.play_box.pack_start(deck, False, False, 0)
- num = 0
- while num < 6:
- self.cards.append( str(random.randint(0, 13))+ random.choice(['coarse', 'cup', 'gold', 'sword']) )
- num += 1
+ #sample
+ sample = Gtk.Label(self.cards[6])
+ self.play_box.pack_start(sample, False, False, 0)
+
+ #card_opponent 1
+ card1 = Gtk.Label(self.cards[3])
+ self.opponent_box.pack_start(card1, True, True, 0)
- '''OPPONENT_CARDS[0] = str(random.randint(0, 13))+ random.choice(['coarse',
- 'cup', 'gold', 'sword'])
- OPPONENT_CARDS[1] = str(random.randint(0, 13))+ random.choice(['coarse',
- 'cup', 'gold', 'sword'])
- OPPONENT_CARDS[2] = str(random.randint(0, 13))+ random.choice(['coarse',
- 'cup', 'gold', 'sword'])
+ #card_opponent 2
+ card2 = Gtk.Label(self.cards[4])
+ self.opponent_box.pack_start(card2, True, True, 0)
- MY_CARDS[0] = str(random.randint(0, 13)) + random.choice(['coarse',
- 'cup', 'gold', 'sword'])
- MY_CARDS[2] = str(random.randint(0, 13)) + random.choice(['coarse',
- 'cup', 'gold', 'sword'])
- MY_CARDS[3] = str(random.randint(0, 13)) + random.choice(['coarse',
- 'cup', 'gold', 'sword'])'''
+ #card_opponent 3
+ card3 = Gtk.Label(self.cards[5])
+ self.opponent_box.pack_start(card3, True, True, 0)
def _click(self, widget):
self.my_box.remove(widget)
- self.play_box.add(widget)
+ self.play_box.pack_start(widget, True, True, 0)
if __name__ == "__main__":
window = Gtk.Window()