From 71dda101c241cd249c36615325041f3e4f7d7ab9 Mon Sep 17 00:00:00 2001 From: ehermakov Date: Sun, 10 Dec 2023 22:44:14 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B6=D0=B0?= =?UTF-8?q?=D1=8E=20=D0=BA=D0=BE=D0=B4=20=D1=81=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B2=D0=BE=D1=80=D0=BE=D1=82=D0=BE=D0=BC=20=D0=BA=D0=BE=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HNS/Excercises/ShipCraft/main.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/HNS/Excercises/ShipCraft/main.py b/HNS/Excercises/ShipCraft/main.py index 42ad99a..6b98c6d 100644 --- a/HNS/Excercises/ShipCraft/main.py +++ b/HNS/Excercises/ShipCraft/main.py @@ -77,7 +77,7 @@ def draw_field(window, field): btn = Button(window, text='', width=5, height=2) btn.grid(column=c, row=r) btn.bind('', lambda e, x=r, y=c: left_button_click(field, x, y)) - btn.bind('', lambda e, x=r, y=c: right_button_click(field, x, y)) + btn.bind('', right_button_click) btn.bind('', lambda e, x=r, y=c: button_enter(field, x, y)) buttons.append(btn) @@ -105,9 +105,14 @@ def left_button_click(field, row, col): colorize(field, buttons) -def right_button_click(field, row, col): - pass - +def right_button_click(d): + global ship_direction + if field_mode == 0: + if ship_direction == 0: + ship_direction = 1 + else: + ship_direction = 0 + def button_enter(field, row, col): if field_mode == 0: