Saravanan666/pypi-org huggingface dataset:
Package: pygame-light2d
Pygame Light 2DThis module provides fast 2D dynamic lighting forpygame.https://github.com/MarkelZ/pygame-light2d/assets/60424316/a8d1322b-ac05-47d4-8b04-2786f0d3c96aSystem requirementsPythonversion >= 3.10OpenGLversion >= 3.3Python package dependenciesnumpy>= 1.24.1pygame>= 2.3.0moderngl>= 5.8.2PyOpenGL>= 3.1.6InstallationFirstly, ensure that your system meets theSystem requirements.Then, run the following command:python3-mpipinstallpygame-light2dTo verify correct installation, open a Python terminal and import the module:importpygame_light2dIf there are no errors, the installation was successful!Getting startedTo learn how to create a simple game with lighting effects usingpygame-light2d, check out theGetting startedpage on the wiki.DocumentationUsing the APIFor detailed explanations of the API, please refer to theAPI Reference.Usingpygame-light2din an existing projectIf you're looking to incorporatepygame-ligth2dinto an existing project, we recommend starting with our guide onAdding lights to an existing project.Frequently Asked QuestionsFor frequently asked questions check outFAQ.ContributingWe greatly appreciate and encourage contributions from the community!Please take a look at theContributingpage on the wiki for details on how to contribute to the project.LicenseThis code is licensed under the terms of the MIT license.
Package: pygamelive
AboutThis module provides live coding in pygame.You can see your code changes at once without restart application.https://user-images.githubusercontent.com/125838640/226334376-04f91f11-1775-49e5-8b04-2704e3355197.mp4Note:Your Game should be implemented OOP styleInstallingpip install pygameliveHow to use?Step 1Import PygameLive class from package.frompygameliveimportdebuggerStep 2Create instance of PygameLive class in your game class.def__init__(self):pg.init()self.screen=pg.display.set_mode(RES)self.clock=pg.time.Clock()self.load_assets()self.sound=Sound()self.score=Score(self)self.fire=DoomFire(self)self.new_game()self.py_live=debugger.PygameLive()Step 3Usedebugmethod on your draw, update and check_event methods in your game loop.defrun(self):whileTrue:# self.check_events()# self.draw()# self.update()#Live codingself.py_live.debug(self.draw)self.py_live.debug(self.update)self.py_live.debug(self.check_events)Your code changes on the methods which you added usingself.py_live.debug(self.draw)will be displayed immediatelyNote:You can name your methods differently but the design of your game should be alike the design pattern noted below.Example GameExample game (FlappyDooM) is made by Stanislav PetrovStanislavPetrovV.Critical InfoYou should design your game like this to work PygameLive properly(highly recommended to look up example folder):graph LR

B(Game Object Renderer 1) --> C(Main Renderer)
D(Game Object Renderer 2) --> C(Main Renderer)
E(Game Object Renderer 3) --> C(Main Renderer)Note:Please look up example repo and change main.py file with the orginal one.
Package: pygame_loaders
This module was originaly a simple syntaxic sugar for a pygame project,for performances sake it quickly gained memoization, allowing you to
call for images, not carring if you already loaded them or not. As you
may need to do that for result of process on those images, the image
loader gained a lot of keywords, that allow to call images with a
zooms, blending, reversing, scaling, rotating, and all sort of
combinations, everytime doing only the required parts of those
processings, and using previous results of processings. Okay, it can
takes up big memory amounts, but well, i found it’s most of the time
less of the problem than CPU, so if you agree, you will probably agree
that for games, it’s an acceptable tradeoff.Oh, for convenience sakes, it can load bunch of text and musics, too,
the processing part is less developped on these ones, but contributions
are welcomed, and memoization is done for them too.Anyway, using it is quite simple, simply import the needed loaders from
loaders.py, and for an image filepath, image() will return a tupple
containing the image and it’s size, no need to store it away, calling
the loader a second time or more is basically free, thanks to
memoization.pygame must be loaded and display_mode set to perform most
image operations.>>> from pygame_loaders import image
>>> image('myimage.png') # actual loading
(<Surface(491x546x32 SW)>, <rect(0, 0, 491, 546)>)>>> image('myimage.png') # returning same result, without any loading
>>> image("myimage.png", zoom=1.5) # only performing zoom
(<Surface(736x819x32 SW)>, <rect(0, 0, 736, 819)>)>>> image("myimage.png", zoom=1.5, alpha=0.4) # only changing alpha
(<Surface(736x819x32 SW)>, <rect(0, 0, 736, 819)>)
Package: pygamemadeeasy
Pygame Made EasyThis project aims to some of the complexity of using Pygame for beginner level programmers.This project has been initially developed for use within my own classes that I teach but I hope it might find use for others too.PROJECT HOMEPygameMadeEasyINSTALLpip install pygame pygamemadeeasyUSAGESorry, documentation still to come :-(AUTHORPaul BaumgartenLICENSEMIT License (C) 2019 Paul Baumgarten
Package: pygame-matplotlib
Pygame Matplotlib BackendThis is an attempt to create a dedicated backend for matplotlib
in pygame.The matplotlibFigureobject is replaced by aFigureSurfaceobject
which inherits from bothmatplotlib.figure.Figureandpygame.Surface.Note that the library is in an experimental developement stage and not
all features of standard matplotlib backends are implement at the moment.Installationpip install pygame-matplotlibUsageFirst you will need to specify that you want to use pygame backend.# Select pygame backendimportmatplotlibmatplotlib.use('module://pygame_matplotlib.backend_pygame')Then you can use matplotlib as you usually do.# Standard matplotlib syntaximportmatplotlib.pyplotaspltfig,ax=plt.subplots()# Create a figure containing a single axes.ax.plot([1,2,3,4],[1,4,2,3])# Plot some data on the axes.plt.show()Or you can include the plot in your game using the fact that aFigureis
also apygame.Surfacewith this backend.importpygameimportpygame.displayfig,axes=plt.subplots(1,1,)axes.plot([1,2],[1,2],color='green',label='test')fig.canvas.draw()screen=pygame.display.set_mode((800,600))# Use the fig as a pygame.Surfacescreen.blit(fig,(100,100))show=Truewhileshow:foreventinpygame.event.get():ifevent.type==pygame.QUIT:# Stop showing when quitshow=Falsepygame.display.update()Note that if you want to update the plot during the game, you might
need to callfig.canvas.draw()andscreen.blit(fig)during
the game loop.See examples in test.py or test_show.pyCurrent implementationSupport mainly the basic plotting capabilities.
Package: pygame-menu
Source repo onGitHub,
and run it onRepl.itIntroductionPygame-menu is apython-pygamelibrary for creating menus and GUIs.
It supports several widgets, such as buttons, color inputs, clock objects, drop selectors,
frames, images, labels, selectors, tables, text inputs, color switches, and many
more, with multiple options to customize.Comprehensive documentation for the latest version is available athttps://pygame-menu.readthedocs.ioNote: Forpygame-ce, check outpygame-menu-ce.Install InstructionsPygame-menu can be installed via pip. Simply run:$>pipinstallpygame-menu-UTo build the documentation from a Git repository:$>clonehttps://github.com/ppizarror/pygame-menu$>cdpygame-menu$>pipinstall-e."[docs]"$>cddocs$>makehtml
Package: pygame-menu-ce
Source repo onGitHub,
and run it onRepl.itIntroductionPygame-menu-ce is apython-pygame-celibrary for creating menus and GUIs. It supports
several widgets, such as buttons, color inputs, clock objects, drop selectors,
frames, images, labels, selectors, tables, text inputs, color switches, and many
more, with multiple options to customize.Comprehensive documentation for the latest version is available athttps://pygame-menu.readthedocs.ioInstall InstructionsPygame-menu-ce can be installed via pip. Simply run:$>pipinstallpygame-menu-ce-UTo build the documentation from a Git repository:$>clonehttps://github.com/ppizarror/pygame-menu$>cdpygame-menu$>pipinstall-e."[docs]"$>cddocs$>makehtml
Package: pygame-minesweeper
MinesweeperMinesweeper is a single-player puzzle computer game. The objective of the game is to clear a rectangular board containing hidden "mines" or bombs without detonating any of them, with help from clues about the number of neighboring mines in each field. The game originates from the 1960s, and has been written for many computing platforms in use today. It has many variations and offshoots.This simple implementation of minesweeper is done in Python using the game library pygame.The core functionality of the game can be foundhereand the python package for the sprite sheet can be foundhereMotivationThe motivation of these minesweeper projects is to learn the tooling around python projects, how to create CI/CD pipelines for python projects, and distributing python eggs.Getting StartedInstallationpython-mpipinstallpygame-minesweeper# orpipinstallpygame-minesweeperStart a game# if $HOME/.local/bin/ is defined in $PATHminesweeper<basic|intermediate|expert|custom># orpython-mminesweeper<basic|intermediate|expert|custom>`BoardsschemerowscolsminesBasic101010Intermediate161640expert63099custom--rows--cols--minesShow high Scoreminesweeper--show-high-score# orpython-mminesweeper--show-high-score# StdoutBASIC
-----#01 0:00:22.641516#02 0:00:29.936435#03 0:01:02.104885#04 -#05 -#06 -#07 -#08 -#09 -#10 -CUSTOM10X10:5
-----#01 0:00:15.618247#02 -#03 -#04 -#05 -#06 -#07 -#08 -#09 -#10 -Start a game with a different sprite sheetThe--tile-sprite,--face-sprite, and--score-spriteparameters define a set of sprite sheets that are available from thispython package.# if $HOME/.local/bin/ is defined in $PATHminesweeper-h# orpython-mminesweeper-h#stdoutpositionalarguments:{basic,intermediate,expert,custom}optionalarguments:-h,--helpshowthishelpmessageandexit--rowsROWS--colsCOLS--minesMINES--tile-sprite{2.0,2.9,95,2000,fiorito-2000,fiorito-monochrome,fiorito-xp,monochrome}--score-sprite{2000,monochrome}--face-sprite{2000,monochrome}--sprite{2000,monochrome}--show-high-scoreIf the --sprite flag is set it will override the other flags like--tile-sprite,--score-spriteand--face-sprite.# Starting an *Expert* game with a full monochrome spritesheetminesweeperexpert--sprite=monochrome# orpython-mminesweeperexpert--sprite=monochromeCreditsSpritesThe sprites used in this project were created byBlack Squirreland can be foundhere.TODORefactor ProjectReferenceshttps://en.wikipedia.org/wiki/Minesweeper_(video_game)
Package: pygamemode
A Python wrapper for the GameMode client API (https://github.com/FeralInteractive/gamemode).To use this effectively, you'll need to install GameMode on your system. See either your system's package manager or the build instructionshere.Example usage:importgamemodeasgmifgm.request_start()!=0:msg=gm.error_string()raiseValueError('Failed to request gamemode start:{}...'.format(msg))# ...do things here...ifgm.request_end()!=0:msg=gm.error_string()raiseValueError('Failed to request gamemode end:{}...'.format(msg))Seetest.pyfor all available calls.
Package: pygame-networking
Python networking library perfect for use with pygame!on server-side you must create a server using theServerclassfollow the example below!be sure to replace192.168.1.52with a string containing the server IP
and replace8080with an integer containing the server portfrom pygame_networking import Server
server = Server()
server.serve(("192.168.1.52", 8080))To create data that is synced across all clients, You can use thesyncmethodfrom pygame_networking import Server
server = Server()

server.sync("my_variable", "my_data")

server.serve(("192.168.1.52", 8080))replace "my_variable" with a string containing the name you wantreplace "my_data" with a string containing the data the variable is initialized withNOTE: variable data must always be string, this module does not support any other typesOn client-side you must use theconnectmethod to establish a connection with the serverfrom pygame_networking import Server
server = Server()

server.connect(("192.168.1.52", 8080))You can also usesyncfrom client-side to declare new variablesfrom pygame_networking import Server
server = Server()

server.connect(("192.168.1.52", 8080))

server.sync("my_variable", "my_data")usegetandsetto retrieve and modify variablesfrom pygame_networking import Server
server = Server()

server.connect(("192.168.1.52", 8080))

server.set("count", "1")

print(server.get("count"))
Package: py-game-of-life
Conway's Game of LifeThis is Game of Live game simulation, created with pygameGame RulesThe game have few simple rulesEvery cell have 8 neighbours cellsAny live cell with fewer than two, or more than three  live  neighbours cells, diesAny live cell with two or three live neighbours, live to next generationAny dead cell with exactly three live neighbours becomes live next generationIn this version I considered the end of each edge to be the start of the opposite edge, this way we won't have  shapes stuck at the edgesInspirationThis project is inspired fromDevDungeon's VideoInstallationInstall with Pip:pip install py_game_of_lifeInstall from the source:pythom setup.py installRunningRun via launch script installed with pip:py_game_of_lifeRun as a python module:pythom -m  py_game_of_lifeControlspresssto pause and resume the gamepressrto randomize and start overpressqto quitSource Codehttps://github.com/BodaSadalla98/Cookbook/tree/main/python/game_of_live
Package: pygameoflife-dadeerh
Conway's Game of LifeSimple pygame implementation of Conway's Game of LifeScreenshotInstallationinstall with pip:`pip install pygameoflife_dadeerh`Install from source:`python setup.py install`RunningRuin via laucnh script installed with pip package:`pygameoflife_dadeerh`Run as a python module:`python -m pygameoflife_dadeerh`Using inside of code:to import class in to your own code:

    `from pygameoflife_dadeerh import LifeGame`ControlsThere are a couple of keybinds available:q - Quits - Start/Stop (toggle pause)r - Randomize the gridSource Codehttps://github.com/Dadeerh/pygameoflife_dadeerhContactdadeerh91@gmail.com
Package: py-GameOfLife-simplified
GameDriverA simple implementation of Conway's Game of Life.Pythonic interface for easy imports to other projects.Check `GameDriver.py` for referenceINSTALLATION:> pip install py-GameOfLife-simplifiedUSAGE:python3 GameOfLife [options]
Options:
    -h, --help                      :   Show this help message and exit.
    -v, --version                   :   Show version and exit.
    board_size=<int>                :   Set board size.
    show_generation_changes=<bool>  :   Show changes that are going to take 
                                        place in upcoming generation.
    clear_terminal=<bool>           :   Clear terminal before each generation.
    show_board_with_icons=<bool>    :   Show board with icons.
    stepper_mode=<bool>             :   Step through generations.
    next_gen_interval=<float>       :   Display new generation with given 
                                        seconds of interval.
    # In stepper mode, use `Enter` key to move to next generation. 
    # Use `CTRL+C` key-combination to exit in non stepper mode to exit.
    # Use 'Q' key in stepper mode to exit.
Example:
    python3 -m GameOfLife board_size=50 show_generation_changes=False clear_terminal=True show_board_with_icons=true stepper_mode=False next_gen_interval=0.5
Package: pygamepad
py_gamepadPython 3 module that allows you to control your gamepadSupports Python 3 only, becaus of typehintings and some other cool Python 3 things.*3.4+ actually, anyway, 3.10 is out, there's literally no reason to use the old versions-UsageSince I needed to use this thing in my project with some UI and.. things, I've designed it with multithreading support (actually, this is the only option lol) so no need to worry for this, just import needed gamepad, firelistenmethod and you are good to go.Here's an example:# main.pyfromtimeimportsleepfrompygamepad.gamepadsimportGamepaddefmain():gamepad=Gamepad()gamepad.listen()# And that's it# Now you can read gamepad values in the main threadtry:whileTrue:print("START button value:",gamepad.buttons.BTN_START.value)sleep(0.01)except(KeyboardInterrupt,SystemExit):# Kill gamepad's listening threadgamepad.stop_listening()# And exit from the programexit()if__name__=="__main__":main()Q&AOk, how do I know without opening whole module script which gamepad buttons I can use?Since module uses typehinting literally everywhere you just can writegamepad.buttonsand autocomplete will show you all of existing buttons.
Alternatively you may just open Gamepad class and see all the button in itsButtonssubclass.ScreenshotsWhat gamepads does it support?Defender X7 and Xbox 360 for sure. Well, I only own Defender X7 gamepad so I tested it in x-input mode so there's no gyroscope and touch capabilities, BUT you can contribute your changes :)Since people may use like any kind of gamepads (Chinese especially) it may not work out of the box or some buttons may be swapped and etc., in that case you can inherit from default gamepad class (pygamepad.gamepads.default.Gamepad) and alter some things for your case.
I had to do so for my Defender X7 gamepad because Start and Select buttons were swapped for some reason (it usesinputsmodule under the hood and for some reason0x13aand0x13bbuttons are swapped or idk), so I changed Start to Select and Select to Start using specialButtonOverridessubclass where you can.. well.. you've guessed it, override default button mappings:# pygamepad/gamepads/defenderx7.pyfromgamepad.buttonsimportPressButtonfrom.defaultimportGamepadclassDefenderGamepad(Gamepad):classButtonOverrides:BTN_START=PressButton("BTN_SELECT")BTN_SELECT=PressButton("BTN_START")
Package: pygamepal
(Note: I'm also developing theGammaPygame ECS engine!)Add suggestions and bugs here!pygamepalA library of classes and functions to support game development in PygameUsagepip install pygamepalFull example, using all pygamepal classesContentsGameInputSpriteImageCameraTransitionsUtility FunctionsGame (create a game with minimal setup) --Template//Exampleself.size = (x, y)
self.caption = 'text'
self.icon = pygame.image.load('imageURL')
self.fps = x
self.gameTime

self.init()
self.update(gameTime)
self.draw()
self.quit()Input --Example# create new instance
input = pygamepal.Input(longPressDuration=60)

# update() must be called once per frame
input.update(deltaTime=1)
input.isKeyDown(keycode)
input.isKeyPressed(keycode)
input.isKeyReleased(keycode)
input.getKeyDownDuration(keycode)
input.isKeyLongDown(keycode)
input.isKeyLongPressed(keycode)
input.getKeyLongPressPercentage(keycode)SpriteImage --Example# create new instance
spriteImage = pygamepal.spriteImage()

# add one or more sprites, associated with a state
spriteImage.addTextures(firstTexture, *moreTextures, state=None, animationDelay=12, loop=True, hFlip=False, vFlip=False)

# update() must be called once per frame
spriteImage.update()

# draw the current image/animation frame
spriteImage.draw()

# change the current image/animation state
# (does not need to be called for sprite with single state)
spriteImage.setState(state)

# resets the current animation
spriteImage.reset()

spriteImage.pauseCamera --Example# creates a new camera instance
camera = pygamepal.Camera(position=(0, 0), size=(640, 480), target=(0, 0), zoom=1, backgroundColour='gray30', borderColour='black', borderThickness=2, clamp=False, clampRect=(0, 0, 1000, 1000), followDelay=0)

# update() must be called once per frame
camera.update(deltaTime=1)

# draws surface to the destinationSurface, using camera attributes
camera.draw(surface, destinationSurface)Transitions --Example//Showcase# creates a new transition instance
transition = pygamepal.TransitionFade(fromSurface=None, toSurface=None, duration=100, easingFunction=linear)

# update() and draw() should be called each game loop frame
transition.update(deltaTime=1)
transition.draw(surface)

# transition properties
transition.duration = x # number of frames (default) / game time in ms
transition.easingFunction = pygame.linear | pygame.bounceEaseOutUtility functions# draws text with minimal required parameters
drawText(screen, text, x, y, font=None, antialias=True, color=White, background=None)
# minimal example:
drawText(screen, 'Hello, world!')

# returns a list of sub-textures from a large spritesheet/texture
# the list has the same dimensions as the original texture, but
# can be flattened using flatten(2dList).
splitTexture(texture, newTextureWidth, newTextureHeight)
# simple example, splitting a single 96x32 spritesheet into 4 separate textures:
textureList = splitTexture(texture, 32, 32)
firstTexture = textureList[0][0] # or firstTexture = flatten(textureList)[0]

# flattens a 2d list into a single list
newList = flatten(2dList)
# see above for example
Package: pygame-pause
Installationpip install pygame_pauseHow to use it?import pygame
import sys
import os
"""first just import the module"""
from pygame_pause import pausepygame.init()
pygame.mixer.init()
pygame.font.init()
pygame.display.init()
screen=pygame.display.set_mode((1500,800),pygame.RESIZABLE)
pygame.display.set_caption('pause module example')
clock=pygame.time.Clock()
fps=60
def gameloop():
x=100
x_vol=0
y=200
y_vol=0while True:
    mouse=pygame.mouse.get_pos()
    
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            pygame.quit()
        if event.type==pygame.KEYDOWN:
            if event.key==pygame.K_a:
                """second just call the module"""
                pause.pause(gameloop)
            if event.key==pygame.K_RIGHT:
                x_vol=10
            if event.key==pygame.K_LEFT:
                x_vol=-10
            if event.key==pygame.K_UP:
                y_vol=-10
            if event.key==pygame.K_DOWN:
                y_vol=10
        elif event.type==pygame.KEYUP:
            if event.key==pygame.K_RIGHT:
                x_vol=0
            if event.key==pygame.K_LEFT:
                x_vol=0
            if event.key==pygame.K_UP:
                y_vol=0
            if event.key==pygame.K_DOWN:
                y_vol=0



    x+=x_vol
    y+=y_vol

    screen.fill((255,255,255))
    mouse_rect=pygame.draw.rect(screen,(0,0,255),(x,y,100,50))
    clock.tick(fps)
    pygame.display.flip()gameloop()LicenseÂ© 2023 KURBAN HUSSAINThis repository is licensed under the MIT license. See LICENSE for details.
Package: pygame-pgu
Phil’s pyGame Utilities - a collection of handy modules and scripts for PyGame.tileedit  – edit tga based images
leveledit – edit tga based levels in tile, isometric, and hexagonal formatsgui     – gui with standard widget, dialog, connections, and themes
html    – html rendering utilities
layout  – layout utilities
text    – text rendering utilitiestilevid – sprite and tile engine
isovid  – isometric sprite and tile engine
hexvid  – hexagonal sprite and tile engine
engine  – state engine
timer   – a timer for games with set-rate FPS
high    – high score tracking
ani     – animation helpers
algo    – helpful pathfinding algoritms
fonts   – font wrappers, bitmapped fonts
Package: pygame-phyics
pygame phyicspyame phyics이 라이브러리를 설치하기위해선 swig 를 설치해야한다리눅스에 경우:
$ sudo apt-get install swig윈도우에 경우:
[https://sourceforge.net/projects/swig/files/swigwin/swigwin-3.0.2/swigwin-3.0.2.zip/download] 접속후 기다리면 자동으로 다운로드가 진행됨C:\swigwin-3.0.2 위치에 파일 생성
C:\swigwin-3.0.2 위치에 다운받은 파일 압축 풀고 집어넣기윈도우 검색창에 환경변수 으로 검색후 [시스템 환경 변수 편집] 클릭주의웹 검색 결과가 뜨면 철자주의 해서 시스템 환경 변수 편집 로 검색뜬 창에 아래부분에 환경 변수(N)... 클릭
새롭게 뜬 창에 시스템 변수(S) 부분에서 Path 두번 클릭또 새로운 창이 생성되면 [새로 만들기(N)] 클릭
C:\swigwin-3.0.2 입력
그리고 컴퓨터 재시작후 라이브러리 설치 진행pip install setuptools wheelpip install pygame_phyics
Package: pygame-physics
A simple way to manage physics in pygame.The Physics() object contains all the info you need.p = Physics(

    # rect is a pygame.Rect object that represents the object on screen
    rect,

    # All of these values are vectors (x, y) where the x/y represent pixels per second
    initVelocity=(0, 0),
    initAcceleration=(0, 0),
    initAngularVelocity=0,
    initAngularAcceleration=0,
    friction=0,  # friction in pixels per second (for both x and y directions)
    angularFriction=0,  # degrees per second
)