def create_click(self):
button_style = {
"font_name": ["Kenney Pixel", "Arial", "Kenney Bold"],
"font_size": 20,
"font_color": arcade.color.RED,
"border_width": 2,
"border_color": arcade.color.BLACK,
"bg_color": arcade.color.BLUE, # Hintergrundfarbe des Buttons
"bg_color_pressed": arcade.color.LIGHT_BLUE, # Farbe beim Drücken
"border_color_pressed": arcade.color.BLACK, # Randfarbe beim Drücken
"font_color_pressed": arcade.color.WHITE # Schriftfarbe beim Drücken
}
for i in range(0,4):
start_button = arcade.gui.UIFlatButton(text="HIT",x= 125, y=680 - (i * 150), width=190, height=100, style=button_style)
self.v_box.add(start_button)
start_button.on_click = self.on_click_start
self.manager.add(start_button)
Have came up with this function to create a clickable button. The Button works but I wanna style the bg_color and font_name. If I write it directly into the UIFlatButton nothin happens. I searched the arcade website and it suggested to use the style method which isn’t working for me because I always get an error that “font_name = style.get(…” is noneType which I can’t understand.
Tried to put the button_style elsewhere in my code but still doesn’t change anything
New contributor
Maximilian Striegler is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.