MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / select

Method select

projects/Space Shooter/main.py:60–79  ·  view source on GitHub ↗
(self, code: int)

Source from the content-addressed store, hash-verified

58 self.select(2)
59
60 def select(self, code: int):
61 # Go down the list
62 if code == 1:
63 if self.selected == 1:
64 self.selected = 2
65 self.text_list[1].selected = False
66 else:
67 self.selected -= 1
68 self.text_list[self.selected + 1].selected = False
69
70 # Go up the list
71 if code == 2:
72 if self.selected == 2:
73 self.selected = 1
74 self.text_list[2].selected = False
75 else:
76 self.selected += 1
77 self.text_list[self.selected - 1].selected = False
78
79 self.text_list[self.selected].selected = True
80
81 def buttons_function(self, event: pygame.event):
82 if event.type == pygame.KEYDOWN:

Callers 9

controlsMethod · 0.95
get_article_and_linkFunction · 0.45
downloaderFunction · 0.45
imgdownloaderFunction · 0.45
getLatestComicNumberFunction · 0.45
getNextComicFunction · 0.45
batchDownloaderFunction · 0.45
main.pyFile · 0.45
verifyFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected