загружаю код с переворотом корабля

This commit is contained in:
ehermakov 2023-12-10 22:44:14 +03:00
parent 0dbb775324
commit 71dda101c2
1 changed files with 9 additions and 4 deletions

View File

@ -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('<Button-1>', lambda e, x=r, y=c: left_button_click(field, x, y))
btn.bind('<Button-3>', lambda e, x=r, y=c: right_button_click(field, x, y))
btn.bind('<Button-3>', right_button_click)
btn.bind('<Enter>', lambda e, x=r, y=c: button_enter(field, x, y))
buttons.append(btn)
@ -105,8 +105,13 @@ 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):