Skip to main content

A Pygame button library that fixes text-centering

Project description

Pygame

TRULY CENTERED BUTTON CLASS

Sick and tired of Pygame's uncentered text on your buttons? Look no further!

my_button = Button(params)

Required parameters

  • screen: pygame.Surface
  • text: str
  • COLOR: tuple (r, g, b)
  • center: tuple (x, y)
  • dim: tuple (w, h)

Optional parameters

  • thickness: int (default = 1)
  • radius: int (default = -1)
  • font_size: int (default = w*0.9)

Additional Attributes

  • real_rect: Actual surrounding border seen on screen
  • font_rect: Invisible border that wraps the text
  • screen_color: Screen color behind the button

Methods

  • is_hovered(): Checks if button is hovered (does not update visual state)
  • check_clicked(): Updates visual state of button based on user mouse event

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygame-truly-centered-button-0.5.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file pygame-truly-centered-button-0.5.tar.gz.

File metadata

File hashes

Hashes for pygame-truly-centered-button-0.5.tar.gz
Algorithm Hash digest
SHA256 96a7d1b37cd3b65dfc3cd012f998d7d68af2f40ebbcdcbe8ad36dc07c67ab8a6
MD5 61e7f0ef29c92cff439a180aa66dce20
BLAKE2b-256 3617358ffb2fc86be2f1dfaa6a930a3b3588907aad8f786f3b8c379e6770a577

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page