Кнопка «Воспроизвести» работает нормально, а функция кнопки «Справка» — нет. Я не говорю, что кнопка «Справка» не работает. Код внутри функции не работает. Вот мой код:
Код: Выделить всё
class Button:
# I did not include this because it works completely fine. The problem is in the help window function.
def help_window():
win.fill((0,0,0)) # Doesn't fill the screen completely. The buttons are still shown.
def main():
# The main function
def main_menu():
title_font = pygame.font.SysFont("comicsans", 70)
run = True
win.fill((90, 255, 180))
while run:
play_button = Button((0,255,0), WIDTH/2 - 100, HEIGHT/2 - 30, 200, 70, "Play")
play_button.draw(win, (0,0,0))
help_button = Button((0,255,0), WIDTH/2 - 100, HEIGHT/2 - play_button.height - 120, 200, 70, "Help")
help_button.draw(win, (0,0,0))
pygame.display.update()
pos = pygame.mouse.get_pos()
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
if event.type == pygame.MOUSEBUTTONDOWN:
if play_button.isOver(pos):
main()
elif help_button.isOver(pos):
help_window() # The help window function
pygame.quit()
main_menu()