0

I started learning pygame a couple of days ago, and I would like to make this code better.

import pygame
import pygame_menu

pygame.init()
surface = pygame.display.set_mode((600, 400))
font = pygame_menu.font.FONT_8BIT

menu = pygame_menu.Menu('Projecte MatZanfe', 600, 400,
                       theme=pygame_menu.themes.THEME_SOLARIZED)

menu.add.text_input('Usuari: ',pygame_menu.font.FONT_8BIT)
menu.add.button('Començar', start_the_game,font_color = 'green')
menu.add.button('Sortir', pygame_menu.events.EXIT, font_color = 'red)

I'm trying to make "Projecte MatZanfe" with the font pygame_menu.font.FONT_8BIT The "Començar" green, and the "Sortir" red. I just don't know how to make it happen. Any tips? This code is based from this page:https://pygame-menu.readthedocs.io/en/4.1.3/

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Torchllama
  • 43
  • 1
  • 7
  • 1
    I would suggest reading more than just the fronpage of the docs. A few clicks futher and you get to the [Adding widgets](https://pygame-menu.readthedocs.io/en/4.1.3/_source/add_widgets.html) page, which shows that `add.button` takes addition arguments like `font_color` to change it's visual. – MegaIng Aug 11 '21 at 17:27
  • I have been reading that doc and some others, but I have already done what it is said there and the program keeps running (no errors), but nothing changes. How would you do it? – Torchllama Aug 12 '21 at 15:40
  • Can you please add to the question what you tried that didn't work? e.g. adding `font_color='red'` to the `menu.add.button` call? – MegaIng Aug 12 '21 at 18:43
  • Now I have edited the code. Thanks for the colors issue, I figured it out by your last comment. However, I just can't change the font. – Torchllama Aug 12 '21 at 20:20
  • ... Did you read the page I linked? Right above `font_color`, there is `font_name` – MegaIng Aug 12 '21 at 21:19
  • My bad. I didn't see the one who would let me change the font. Anyway, If I try to put a 'ñ' or 'ç' (both of them are used in Spain) with the font, it appears a ? symbol, probably because it does not recognize it. Any suggestions? – Torchllama Aug 12 '21 at 21:54
  • 1
    The font probably does not support those characters. Choose a different font. – MegaIng Aug 12 '21 at 21:56

0 Answers0