diff options
author | Walter Bender <walter.bender@gmail.com> | 2011-03-04 20:40:06 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2011-03-04 20:40:06 (GMT) |
commit | c3311778cd7237bdff59f9106eca3dc367737772 (patch) | |
tree | 2c677b7ed02e69fbd207ec0f96e74c65e8985357 /path.py |
new project
Diffstat (limited to 'path.py')
-rwxr-xr-x | path.py | 68 |
1 files changed, 68 insertions, 0 deletions
@@ -0,0 +1,68 @@ +#!/usr/bin/env python + +#Copyright (c) 2009,10 Walter Bender + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +import gtk + +from gettext import gettext as _ +import os + +from game import Game + + +class PathMain: + def __init__(self): + self.r = 0 + self.tw = None + + # create a new window + self.win = gtk.Window(gtk.WINDOW_TOPLEVEL) + self.win.maximize() + self.win.set_title("%s: %s" % (_("Paths"), + _("Move tiles to make a path."))) + self.win.connect("delete_event", lambda w,e: gtk.main_quit()) + + # A vbox to put a menu and the canvas in + vbox = gtk.VBox(False, 0) + self.win.add(vbox) + vbox.show() + + canvas = gtk.DrawingArea() + vbox.pack_end(canvas, True, True) + canvas.show() + + self.win.show_all() + + # Join the activity + self.vmw = Game(canvas, os.path.join(os.path.abspath('.'), + 'images/')) + self.vmw.win = self.win + self.vmw.activity = self + self.vmw.level = 12 + + self.vmw.new_game() + + def set_title(self, title): + self.win.set_title(title) + + def _new_game_cb(self, widget, game): + self.vmw.new_game() + return True + +def main(): + gtk.main() + return 0 + +if __name__ == "__main__": + PathMain() + main() |