Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/game.py
diff options
context:
space:
mode:
authorCristhofer Travieso <cristhofert97@gmail.com>2013-06-29 23:11:09 (GMT)
committer Cristhofer Travieso <cristhofert97@gmail.com>2013-06-29 23:11:09 (GMT)
commitf9ea9e712f8d3e2e5854ffd580add032e5c6670f (patch)
tree026f9039d64bef4210c88df3b40dd4ef7e2058f4 /game.py
parent1320ee2e3a15317597bdc845334ed8a1126b1077 (diff)
Add MyCard class
Signed-off-by: Cristhofer Travieso <cristhofert97@gmail.com>
Diffstat (limited to 'game.py')
-rw-r--r--game.py49
1 files changed, 35 insertions, 14 deletions
diff --git a/game.py b/game.py
index a1c77fa..2a58d77 100644
--- a/game.py
+++ b/game.py
@@ -25,8 +25,8 @@ class Fixed(Gtk.Fixed):
def __init__(self):
Gtk.Fixed.__init__(self)
- alloc = self.get_allocation()
- width = alloc.width()
+ width = 1300
+ height = 700
#opponent cards
opponent_card1 = Card()
@@ -37,12 +37,12 @@ class Fixed(Gtk.Fixed):
self.put(opponent_card3, width/2, 20)
#my cards
- card1 = Card()
- self.put(card1, width/2, 60)
- card2 = Card()
- self.put(card2, width/2, 70)
- card3 = Card()
- self.put(card3, width/2, 80)
+ card1 = MyCard()
+ self.put(card1, width/2, height-10)
+ card2 = MyCard()
+ self.put(card2, width/2, height-20)
+ card3 = MyCard()
+ self.put(card3, width/2, height-30)
#sample
sample = Gtk.Image()
@@ -53,19 +53,19 @@ class Fixed(Gtk.Fixed):
self.put(deck, 0, 50)
grid = Gtk.Grid()
- self.put(grid, 1000, 500)
+ self.put(grid, width*0.90, height*0.90)
truco_btn = Gtk.Button('Truco')
- grid.next(truco_btn)
+ grid.add(truco_btn)
retruco_btn = Gtk.Button('Retruco')
- grid.next(retruco_btn)
+ grid.add(retruco_btn)
vale4_btn = Gtk.Button('Vale 4')
- grid.next(vale4_btn)
+ grid.add(vale4_btn)
- flor_btn = Gtk.Button('Vale 4')
- grid.next(flor_btn)
+ flor_btn = Gtk.Button('Flor')
+ grid.add(flor_btn)
class Card(Gtk.Button):
@@ -86,3 +86,24 @@ class Card(Gtk.Button):
#def repartir():
#repartir cartas
+
+
+class MyCard(Gtk.Button):
+
+ def __init__(self):
+ Gtk.Button.__init__(self)
+
+ self.image = Gtk.Image()
+ self.add(self.image)
+
+ self.x = 0#obtener posicion de la carta
+ self.y = 0#obtener posicion de la carta
+
+ def play(self, center):
+ fixed.move(self, center[0]/2, center[1]/2)
+
+ def back(self):
+ fixed.move(self, self.x, self.y)
+
+#def repartir():
+ #repartir cartas