def handle(self, event):
gd.BoardGame.handle(self, event) # send event handling up
if self.show_msg == False:
if event.type == pygame.KEYDOWN and event.key != pygame.K_RETURN and not self.correct:
lhv = len(self.home_square.value)
self.changed_since_check = True
if event.key == pygame.K_BACKSPACE:
if lhv > 0:
self.home_square.value = self.home_square.value[0:lhv - 1]
else:
char = event.unicode
if (len(char) > 0 and lhv < 5 and char in self.digits):
self.home_square.value += char
self.home_square.update_me = True
self.mainloop.redraw_needed[0] = True
elif event.type == pygame.MOUSEBUTTONUP:
self.home_square.update_me = True
if self.board.active_ship == self.home_square.unit_id:
self.home_square.perm_outline_width = 5
self.home_square = self.ans_h
self.board.active_ship = self.home_square.unit_id
self.home_square.update_me = True
self.mainloop.redraw_needed[0] = True
评论列表
文章目录