diff options
author | Cristhofer Travieso <cristhofert97@gmail.com> | 2013-07-18 00:32:41 (GMT) |
---|---|---|
committer | Cristhofer Travieso <cristhofert97@gmail.com> | 2013-07-18 00:32:41 (GMT) |
commit | 2eee2f293a3bab7388c390ec8507afa2dd3958f9 (patch) | |
tree | dba0f86776137b34de2ef6bb0b15a63c83f6bd8b | |
parent | f9ea9e712f8d3e2e5854ffd580add032e5c6670f (diff) |
Fixing bugs of pocition
Signed-off-by: Cristhofer Travieso <cristhofert97@gmail.com>
-rw-r--r-- | game.py | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -19,30 +19,32 @@ from gi.repository import Gtk from gi.repository import GObject +WIDTH = 1200 +HEIGHT = 700 class Fixed(Gtk.Fixed): def __init__(self): Gtk.Fixed.__init__(self) - width = 1300 - height = 700 - #opponent cards opponent_card1 = Card() - self.put(opponent_card1, width/2, 0) + self.put(opponent_card1, WIDTH/2, 0) opponent_card2 = Card() - self.put(opponent_card2, width/2, 10) + self.put(opponent_card2, WIDTH/2, 10) opponent_card3 = Card() - self.put(opponent_card3, width/2, 20) + self.put(opponent_card3, WIDTH/2, 20) #my cards card1 = MyCard() - self.put(card1, width/2, height-10) + card1.connect('clicked', self.play_card) + self.put(card1, WIDTH/2, HEIGHT-10) card2 = MyCard() - self.put(card2, width/2, height-20) + card2.connect('clicked', self.play_card) + self.put(card2, WIDTH/2, HEIGHT-20) card3 = MyCard() - self.put(card3, width/2, height-30) + card3.connect('clicked', self.play_card) + self.put(card3, WIDTH/2, HEIGHT-30) #sample sample = Gtk.Image() @@ -53,7 +55,7 @@ class Fixed(Gtk.Fixed): self.put(deck, 0, 50) grid = Gtk.Grid() - self.put(grid, width*0.90, height*0.90) + self.put(grid, WIDTH*0.90, HEIGHT*0.90) truco_btn = Gtk.Button('Truco') grid.add(truco_btn) @@ -67,20 +69,23 @@ class Fixed(Gtk.Fixed): flor_btn = Gtk.Button('Flor') grid.add(flor_btn) + def play_card(self, widget): + self.move(widget, WIDTH/2, HEIGHT/2+100) + + def back(self): + fixed.move(self, self.x, self.y) + class Card(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) @@ -99,11 +104,6 @@ class MyCard(Gtk.Button): 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 |