Made the changes in the latest commit work.
This commit is contained in:
parent
542e6b39ca
commit
57ded2ff83
1 changed files with 3 additions and 2 deletions
5
pg.py
5
pg.py
|
@ -98,6 +98,8 @@ class Button:
|
|||
|
||||
class TextButton:
|
||||
def __init__(self, text: str, position: Union[tuple, Callable], surface: pygame.Surface, function=None, key: int=0, text_color: tuple=white, bg_color: tuple=gray, font: pygame.font.Font=default_font, padding: int=8):
|
||||
self.text_object = self.generate_text(text)
|
||||
|
||||
self.text = text
|
||||
self.surface = surface
|
||||
self.function = function
|
||||
|
@ -115,7 +117,6 @@ class TextButton:
|
|||
self.position = position()
|
||||
self.callable_position = position
|
||||
|
||||
self.text_object = self.generate_text(text)
|
||||
self.background = self.generate_background()
|
||||
|
||||
self.button = Button(function, self.background, key=key)
|
||||
|
@ -129,7 +130,7 @@ class TextButton:
|
|||
w, h = self.text_object.get_size()
|
||||
w, h = w + self.padding * 2, h + self.padding * 2
|
||||
|
||||
return pygame.Rect(self.pos, (w, h))
|
||||
return pygame.Rect(self.position, (w, h))
|
||||
|
||||
def update(self, new_text: str=None, new_pos: Union[tuple, Callable]=None, new_surface: pygame.Surface=None, new_func=None, new_key: int=None, new_text_color: tuple=None, new_bg_color: tuple=None, new_font: pygame.font.Font=None, new_padding: int=None):
|
||||
if new_text is None:
|
||||
|
|
Loading…
Reference in a new issue