I'm trying to create an input box for one of my windows in pygame. I have created the class for it but when I tried to display the input box it gave me an error. Here is the code for the input box:
class inp_box:
def __init__(self, xpos, ypos, width, height, text = ""):
  self.rect = pygame.Rect(xpos, ypos, width, height)
  self.colour = [200, 200, 200]
  self.text = text
  self.text_surf = FONT.render(text , True, self.colour)
  self.current = False
  self.colourAc = False
  
def enter_text(self, event):
    if event.type == pygame.MOUSEBUTTONDOWN:
        if self.rect.collidepoint(event.pos):
            self.colourAc = not self.colourAc
        else:
            self.colourAc = False
        if self.colourAc:
            self.color = [150, 150, 150]
        else:
            self.color = [200, 200, 200]
    if event.type == pygame.K_KEYDOWN:
        if self.colourAc:
            if event.key == pygame.K_RETURN:
                print(self.text)
                self.text = ""
            elif event.key == pygame.K_BACKSPACE:
                self.text = self.text[:-1]
            else:
                self.text += event.unicode
            self.text_surf = FONT.render(self.text, True, self.colour)
def Updtext(self):
    widt = max(200, self.text_surf.get_width() + 10)
    self.rect.width = widt
def showBox(self, display):
    display.blit(self.text_surf, (self.rect.xpos + 5, self.rect.ypos + 5))
    pygame.draw.rect(display, self.colour, self.rect)
This is part of the main loop where the input box would be displayed:
elif set_wind.checkUp():
    main_wind_but = return_but.hover(mouse_pos, mouse_click)
    return_but.showBut(set_wind.reTitle())
    enter_wind_but = enter_but.hover(mouse_pos, mouse_click)
    enter_but.showBut(set_wind.reTitle())
    title1_box.showBut(set_wind.reTitle())
    desc1_box.showBut(set_wind.reTitle())
    input_box.showBox(set_wind)
    if main_wind_but:
        Main = main_wind.setCurrent()
        set_wind.endCurrent()
This is the error I got:
Traceback (most recent call last):
File "main.py", line 282, in <module>
input_box.showBox(set_wind)
File "main.py", line 128, in showBox
display.blit(self.text_surf, (self.rect.xpos + 5, self.rect.ypos + 5))
AttributeError: 'window' object has no attribute 'blit'
I've tried to find solutions to this problem but none of them seem to answer my problem. I appreciate any help and thanks in advance.
 
    