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:
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 char in self.digits:
if len(char) > 0 and lhv < 3:
self.home_square.value += char
else:
self.home_square.value = char
self.home_square.update_me = True
self.mainloop.redraw_needed[0] = True
评论列表
文章目录