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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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