Skip to main content

python package for pygame to make buttons

Project description

python package for pygame to make buttons with cool hovers , resize , functions and more all in a really fast and easy way !

example:

import pygame, sys, pygame_easy_btn
pygame.init()

width, height = 1280, 720
screen = pygame.display.set_mode((width, height), 0, 32)
pygame.display.set_caption("example")
fps = 30
clock = pygame.time.Clock()

def main():
    print ("hi" )
    screen.fill((0, 0, 0))

def main1():
    print ("hi" )
    screen.fill((0, 0, 0))
    
while True:
    print (pygame_easy_btn.clicked)
    pygame_easy_btn.mainloop()
    screen.fill((255, 255, 255))
    pygame_easy_btn.img_button_with_hover(screen, 50, 50, "help.png", "help2.png", 50, 50, main)
    pygame_easy_btn.img_button_with_hover(screen, 200, 400, "help.png", "help2.png", 50, 50, main1)
    pygame_easy_btn.img_button_without_hover(screen, 200, 200, "help.png", 50, 50, main)
    pygame_easy_btn.shape_button_with_hover(screen, 500, 200, (0, 0, 0), (20, 20, 20), 100, 100, main)
    pygame_easy_btn.shape_button_without_hover(screen, 500, 500, (0, 0, 0), 100, 100, main)
    pygame_easy_btn.text_button_with_hover(screen, "Hi ", 700, 600, (0, 0, 0) , (255, 0, 0), clicked_function=main)
    for event in pygame.event.get():
        pass


    pygame.display.update()
    clock.tick(fps)

document: # you must enter this command in gameloop: pygame_easy_btn.mainloop() #you can put an image button with hover in screen using :

pygame.img_button_with_hover(surface, X pos, Y pos, file, hover_file, scale width, scale height, When clicked call this function)

#you can put an image button without hover in screen using :

pygame.img_button_without_hover(surface, X pos, Y pos, file, scale width, scale height, When clicked call this function)

#you can put rectangle button with hover in screen using :

pygame.shape_button_with_hover(surface , x_position, y_position , color, hover_color, width, height, When clicked call this function)

#you can put rectangle button without hover in screen using :

pygame.shape_button_without_hover(surface , x_position, y_position , color, width, height, When clicked call this function)

#you can put text button with hover in screen using :

pygame.text_button_with_hover(surface , text , x_position, y_position , color, hover_color,  font = pygame.font.Font(None, 40), When clicked call this function)

#you can put text button without hover in screen using :

pygame.text_button_without_hover(surface , text , x_position, y_position , color,  font = pygame.font.Font(None, 40), When clicked call this function)

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_easy_btn-1.0.3.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygame_easy_btn-1.0.3-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file pygame_easy_btn-1.0.3.tar.gz.

File metadata

  • Download URL: pygame_easy_btn-1.0.3.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for pygame_easy_btn-1.0.3.tar.gz
Algorithm Hash digest
SHA256 7cff00e755c4c656330205767ed0775390318bb1d137eecfa6d33699cb9ecc97
MD5 70b5285877188ba37293e526aab35204
BLAKE2b-256 4bf122401b5fd80e1d6e7c92ba0d981b51bd1ff811d6139bef0259e7238e3043

See more details on using hashes here.

File details

Details for the file pygame_easy_btn-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: pygame_easy_btn-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for pygame_easy_btn-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e604cc1bc256a1a08ce93f2ad980a579b306ea99918bd3a4c01f3ba47c65984f
MD5 d4c096a6a6471320fbfcfa5db816a1f4
BLAKE2b-256 d307ff177c870c6eb4d50dcf2d5f8a06876edd498efc9304098f7d6549987b11

See more details on using hashes here.

Supported by

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