Bonsoir je n'arrive pas à comprendre cette classe si quelqu'un pourrait me l'expliquer en détail si possible ? Merci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pygame
from pygame.locals import *
import sys
 
 
pygame.font.init()
class Button:
    """Classe pour faire des boutons"""
    def __init__(self, window,posX, posY, rect, button_color=(0,0,0)):
        self.window=window
        self.posX=posX
        self.posY = posY
        self.rect=rect
        self.button_color= button_color
 
 
    def drawButton(self,text,fontsize=15,text_color=(150,150,150)):
        """Dessine un bouton"""
        myfont = pygame.font.SysFont('Comic Sans MS', fontsize) #Initialise la police
        textsurface = myfont.render(text, 1, text_color)
        return  pygame.draw.rect(self.window,self.button_color,self.rect,0) and self.window.blit(textsurface,(self.posX,self.posY)) #Affiche bouton+texte