Я хочу взять размер шрифта (14) и с помощью pygame_widgets.button.Button() масштабировать его, чтобы он соответствовал размеру шрифта до максимального значения
почти каждый раз вопрос, который я видел здесь, на данный момент был противоположным. Я не знаком с математическими расчетами, которые будут использоваться, но я был бы очень признателен за помощь
import pygame
import pygame_widgets
from pygame_widgets.button import Button
pygame.init()
font_size = 14
screen = pygame.display.set_mode((640, 480))
font = pygame.font.SysFont('Arial', font_size)
Wide = 60 # Math
High = 20 # Math
button = Button(
screen, # surface to display
10, # Button's top left x coordinate
10, # Button's top left y coordinate
Wide, # Button's Width
High, # Button's Height
text="Button",
fontSize=font_size,
inactiveColour=(255, 255, 255),
hoverColour=(245, 245, 245),
pressedColour=(230, 230, 230),
radius=2, # curve on the button corners
onClick=lambda: print("Click")
)
while True:
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
screen.fill((200, 200, 200))
pygame_widgets.update(events)
pygame.display.update()
Подробнее здесь: https://stackoverflow.com/questions/790 ... -font-size