загружаю код с переворотом корабля
This commit is contained in:
parent
0dbb775324
commit
71dda101c2
|
@ -77,7 +77,7 @@ def draw_field(window, field):
|
||||||
btn = Button(window, text='', width=5, height=2)
|
btn = Button(window, text='', width=5, height=2)
|
||||||
btn.grid(column=c, row=r)
|
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-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))
|
btn.bind('<Enter>', lambda e, x=r, y=c: button_enter(field, x, y))
|
||||||
buttons.append(btn)
|
buttons.append(btn)
|
||||||
|
|
||||||
|
@ -105,9 +105,14 @@ def left_button_click(field, row, col):
|
||||||
colorize(field, buttons)
|
colorize(field, buttons)
|
||||||
|
|
||||||
|
|
||||||
def right_button_click(field, row, col):
|
def right_button_click(d):
|
||||||
pass
|
global ship_direction
|
||||||
|
if field_mode == 0:
|
||||||
|
if ship_direction == 0:
|
||||||
|
ship_direction = 1
|
||||||
|
else:
|
||||||
|
ship_direction = 0
|
||||||
|
|
||||||
|
|
||||||
def button_enter(field, row, col):
|
def button_enter(field, row, col):
|
||||||
if field_mode == 0:
|
if field_mode == 0:
|
||||||
|
|
Loading…
Reference in New Issue