tanchiki
diff tk_ui.py @ 44:759a040a5f94
Nicer welcome message (in tk_ui)
author | Daniil Alexeyevsky <me.dendik@gmail.com> |
---|---|
date | Mon, 20 Dec 2010 20:25:57 +0300 |
parents | dd0574c45bb9 |
children | 1d0efaea3702 |
line diff
1.1 --- a/tk_ui.py Mon Dec 20 20:20:22 2010 +0300 1.2 +++ b/tk_ui.py Mon Dec 20 20:25:57 2010 +0300 1.3 @@ -17,6 +17,14 @@ 1.4 'x': 'fire', 1.5 } 1.6 1.7 +welcome = """Press F5 to start 1.8 + 1.9 +Keys are: 1.10 +a, d -- turn tank 1.11 +q, e -- turn muzzle 1.12 +w, s -- change speed 1.13 +x -- fire""" 1.14 + 1.15 class Tank(body.Tank): 1.16 1.17 def on_tick(self, tanks, bullets): 1.18 @@ -53,10 +61,12 @@ 1.19 canvas = self.canvas = tk.Canvas(root, background="black") 1.20 canvas.pack(fill="both", expand="yes") 1.21 1.22 + def display_welcome(self): 1.23 root.update() 1.24 w, h = canvas.winfo_width(), canvas.winfo_height() 1.25 - canvas.create_text(w/2, h/2, text="Press F5 to start", 1.26 - fill="red", justify="center", font="15") 1.27 + canvas.create_rectangle(0, 0, w, h, fill="#211") 1.28 + canvas.create_text(w/2, h/2, text=welcome, 1.29 + fill="red", justify="center", font="bold 15") 1.30 1.31 def on_key(self, ev): 1.32 if ev.keysym == "F5":