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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for pygame_easy_btn-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e604cc1bc256a1a08ce93f2ad980a579b306ea99918bd3a4c01f3ba47c65984f |
|
MD5 | d4c096a6a6471320fbfcfa5db816a1f4 |
|
BLAKE2b-256 | d307ff177c870c6eb4d50dcf2d5f8a06876edd498efc9304098f7d6549987b11 |