[gcompris/gcomprixogoo] Added an ok button uppon loose or win to let the children check his answer.
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris/gcomprixogoo] Added an ok button uppon loose or win to let the children check his answer.
- Date: Sun, 17 Oct 2010 14:49:21 +0000 (UTC)
commit bf7d634806c82cc6fd9df38b3b9835e1525abfcc
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Sun Oct 17 16:48:31 2010 +0200
Added an ok button uppon loose or win to let the children check
his answer.
src/hangman-activity/hangman.py | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/hangman-activity/hangman.py b/src/hangman-activity/hangman.py
index 0aa7134..9304362 100644
--- a/src/hangman-activity/hangman.py
+++ b/src/hangman-activity/hangman.py
@@ -268,6 +268,28 @@ class Gcompris_hangman:
letters += v
return letters
+ def ok_event(self, widget, target, event=None):
+ if self.gamewon == 2:
+ gcompris.bonus.display(gcompris.bonus.LOOSE, gcompris.bonus.TUX)
+ else:
+ gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.TUX)
+
+ def display_ok(self):
+ # The OK Button
+ item = goocanvas.Svg(parent = self.rootitem,
+ svg_handle = gcompris.skin.svg_get(),
+ svg_id = "#OK"
+ )
+ zoom = 0.8
+ item.translate( (item.get_bounds().x1 * -1)
+ + ( gcompris.BOARD_WIDTH - 300 ) / zoom,
+ (item.get_bounds().y1 * -1) + 190.0 / zoom)
+ item.scale(zoom, zoom)
+ item.connect("button_press_event", self.ok_event)
+ gcompris.utils.item_focus_init(item, None)
+
+
+
# A letter to find displayed on the screen
class Letter:
def __init__(self, hangman, x, y,
@@ -383,10 +405,10 @@ class Key:
if self.hangman.trial == 0:
self.hangman.gamewon = 2
self.hangman.hide_letters(False)
- gcompris.bonus.display(gcompris.bonus.LOOSE, gcompris.bonus.TUX)
+ self.hangman.display_ok()
elif self.hangman.found_all_letters():
self.hangman.gamewon = 1
- gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.TUX)
+ self.hangman.display_ok()
return True
#
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]