Closed deegquest closed 3 years ago
Yes. To do so, just pass in a tuple into the constructor with keyword argument 'fonts'. E.g.
ButtonArray(win, x, y, width, height, shape, fonts=('font1', 'font2', 'font3'))) for a button array with 3 buttons. The same applies for fontSizes. Currently, if all the buttons have the same properties, you need to repeat. This may be fixed later.
Thanks, I will try it when I get the chance.
I got it to work, not with the font str name, but with the font object combined with the size (not a separate fontSizes=()). The below works: font1 = pygame.font.Font(pygame.font.match_font('arial'), 50) font2 = pygame.font.Font(pygame.font.match_font('impact'), 60) red = (200, 0, 0) green = (0, 40, 0) buttonArray = ButtonArray(win, 50, 50, 500, 500, (2, 2), border=100, texts=('1', '2', '3', '4'), fonts=(font1, font2, font1, font2), textColours=(red, green, red, green) )
I'm not sure why this is happening, but I will look into it.
The fonts keyword argument takes Font objects not strings. The fontSize keyword argument only applies for the default font and is overridden by the fonts provided.
Is it possible to set the font and font size with ButtonArray?