I'm relatively new when it comes to python, and do know how to convert strings to integers. However, for some reason I'm unable to when drawing lines from pygame. Before converting the code to integer, it said I had a deprecation warning and required integers instead of the floats I had. I did what it told me, but now I get an error saying int() can't convert non-string with explicit base.
Before conversion:
def draw_board(board):
pygame.draw.line(screen,WHITE, (WIDTH/3,0),(WIDTH/3,HEIGHT),5)
pygame.draw.line(screen,WHITE,(WIDTH/1.5,0),(WIDTH/1.5,HEIGHT),5)
pygame.draw.line(screen,WHITE,(0,HEIGHT/1.5),(WIDTH,HEIGHT/1.5),5)
pygame.draw.line(screen,WHITE,(0,HEIGHT/3),(WIDTH,HEIGHT/3),5)
After conversion:
def draw_board(board):
pygame.draw.line(screen,WHITE, (int (WIDTH/3,0), int (WIDTH/3,HEIGHT)),5)
pygame.draw.line(screen,WHITE,(int (WIDTH/1.5,0), int (WIDTH/1.5,HEIGHT)),5)
pygame.draw.line(screen,WHITE,(int (0,HEIGHT/1.5), int (WIDTH,HEIGHT/1.5)),5)
pygame.draw.line(screen,WHITE,(int (0,HEIGHT/3),int (WIDTH,HEIGHT/3)),5)
int(WIDTH/1.5), 0)x1 = int(WIDTH/3) y1 = int(0)and later use itline( ..., x1, y1, ...). This way code will be more readable and you will see where you made mistake in original code. You doint (WIDTH/3,0)but you need( int(WIDTH/3), int(0) )or( int(WIDTH/3), 0 )int(). Try converting each one separately like:pygame.draw.line(screen, WHITE, (int(WIDTH/3), 0), (int(WIDTH/3), int(HEIGHT)), 5).