Saravanan666/pypi-org huggingface dataset:
Package: pygame-popup
Pygame Popup ManagerDocs are now available at:https://pygame-popup-manager.readthedocs.io/en/latest/Pygame Popup Manager is a very small engine permitting to easily build all kind of popup in a pygame project.Here is an example of basic menus that could be created with this manager:InstallationThe easiest way to install this package is to do it withpip:pip install pygame-popupUseFirst, don't forget to callpygamepopup.initfunction right after
callingpygame.initfunction.The whole system is working around theMenuManagerclass that is
the controller of all the popups in background and in foreground.An unique instance per scene/window has to be created and the pygame screen
on which the popups will appear should be provided, like this:frompygamepopup.menu_managerimportMenuManagermenu_manager=MenuManager(screen)Thedisplay,motionandclickmethods of this class should be called in the application main loop
in order to notify the manager of any pygame event.To open a new popup menu, you should first create it by instantiate theInfoBoxclass.
The components that should be in the menu should be provided.
Next, don't forget to call theopen_menumethod of the menu manager to notify it about the new menu.For example, the following code will open a popup with a "do-nothing" button and a close button (added by default by theInfoBox)frompygamepopup.componentsimportButton,InfoBoxmy_custom_menu=InfoBox("Title of the Menu",[Button(title="Hello World!",callback=lambda:None)])menu_manager.open_menu(my_custom_menu)If you want more code illustrations, check theexamples/minimal_main_menu.pymodule.CustomizationThe default graphics resources can be easily changed by your own by simply calling certain methods of theconfigurationmodule, wherever you want, as can be seen below.importpygamepopuppygamepopup.configuration.set_button_background("sprites/inactive_button.png","sprites/active_button.png")pygamepopup.configuration.set_dynamic_button_background("sprites/inactive_button.png","sprites/active_button.png")pygamepopup.configuration.set_info_box_background("sprites/menu_box.png")It is also possible to directly provide an asset to a specific component, if you want a button to be different from others for example.Button(title="Hello World!",callback=lambda:None,sprite=pygame.image.load("sprites/different_button.png"),sprite_hover=pygame.image.load("sprites/different_button_hover.png"))With this kind of configuration you can made an interface similar to this one:ContactYou can contact me directly bye-mailif you have any question regarding the package.
Also, I will be really happy to know you are using this package, so don't hesitate to share me the link to your project if you tried something!For suggestions or bugs, please create an issue in the GitHub repository:https://github.com/Grimmys/pygame_popup_manager/issuesThanks!
Package: pygamer8
Getting Started with pygamer8pygamer8 is an opinionated way to build with Pygame that makes developers' lives easier and building games more fun!pygamer8 makes developing python games withPygamequick, modular, maintainable, and scalable. You can load a game window in a matter of seconds, build a simple game in a matter of minutes, and then spend as much time as you want to scale your game as far as you like. And it will be easily maintainable, debuggable, and variable. This is due to the central ideas behind the pygamer8 system for Pygame.Centrals ideas behind pygamer8All Games have objects, players, and menusAll objects react to events in specific ways (handlers)All games and objects need to update and draw on each framePlayers need to have their own objects that are coupled to their player instanceMenus should not affect gameplay until active, at which point they should immediately take over the game loopThe current running Game or Menu should receive and delegate all events to the proper handlersStart a game with pygamer8Check out ourexamplesfor an introduction on how to create games.
Package: pygame-render
Pygame RenderPython package for rendering 2D graphics with shaders in Pygame.System requirementsPythonversion >= 3.10OpenGLversion >= 3.3Supported platforms✅Windows✅Mac✅LinuxInstallationFirstly, ensure that your system meets theSystem requirements.Then, run the following command:python3-mpipinstallpygame-renderTo verify correct installation, open a Python terminal and import the module:importpygame_renderIf there are no errors, the installation was successful!Getting startedTo learn about the features ofpygame-render, check out theFeature Walkthroughpage on the wiki.You can also take a look at the examples in theexamples/directory.For detailed explanations of the API, please refer to theAPI Reference.Tutorial video:https://youtu.be/mlm66OJZaA0Python package dependenciesThese packages will be automatically installed bypipalong withpygame-render:numpy>=1.22.0pygame>=2.1.0moderngl>= 5.8.2PyOpenGL>= 3.1.6Frequently Asked QuestionsFor frequently asked questions, check outFAQ.ContributingWe greatly appreciate and encourage contributions from the community!If you want to report a bug or request a new feature, feel free to open an issue in theissue tracker.For code contributions, please check outContributingfor details.LicenseThis code is licensed under the terms of the MIT license.
Package: pygamergui
pygamergui-0.6A simple gui library made using python and pygame module as core.Authors@Bishnu-coder🔗 LinksHow to install ?Install modulepipinstallpygame,pygamerguiDemo VideoDemo imageDemo codefrompygamerguiimportbuttons,slider,text,windowdefb1test(args):t1.text="use->"print(args)defb2test(args):t1.text="Pygamergui"print(args)anemi=text.Word_Animation("pygamergui",color='red')b1=buttons.simple_button(target=b1test,text='use',fg='white',w=75,h=50,color=(0,175,250),args=[1])b2=buttons.simple_button(target=b2test,fg='white',text="PGG",w=100,h=50,color=(0,175,250))t1=text.text("what to use??")r1=buttons.button_radio(radius=30,color='cyan')s1=slider.slider(300,550,h=10,corner_round=10,color='purple',t1_align='side',text_size=20,text_color='black',color_circle=(0,175,250))defupdate():b1.show_no_anemi(200,400,window=windowm,corner_round_level=10)b2.show_color_change(300,400,window=windowm,corner_round_level=10)t1.show(windowm,175,175)a=r1.show(windowm,300,300)ifa:anemi.show(windowm,180,100,4)a=s1.show(windowm)windowm=window.app(title='test',bgcolor=(40,40,40),target=update,update_rate=10,background="python1.png")windowm.run()Project structureAppendixImportant points:all widgets (i.e button,text,slider,Button_radio)can be used importing text,buttons,slider from pygamergui.background image path should be provided to window class as in examplewindow class makes the main window appearAll the show methods should be put in an function which is passed as target to window classBadges
Package: pygamescript
Pure Python Game Script FramebaseminideviceandminicvTemplateImageTemplateMultiColorsTemplateGameScriptscreenshot -> cv2.Matfind(Template,isColor=None,colorThreshold=4)findAndOperate(Template,operate,operateParams)rangeRandomClick(result,duration,randomPointGenerateAlgo)curveSwipe(startX,startY,endX,endY,duration,curveGenerateAlgo)click(x,y,duration)swipe(points,duration)screenshot_raw()save_screenshot(path)
Package: pygamesilent
pygamesilentBackgroundThere is a mature open-source library for building multimedia applications,
like games, calledPyGame.Unfortunately, in an effort to recuit more developers, the maintainers added
some output to the library around version 1.9.4, so it now prints text similar
to this upon import:pygame 1.9.6Hello from the pygame community.https://www.pygame.org/contribute.htmlThis move has beenconfusing(especially for user-facing command-line tools) andcontroversialbutcomplaints about the behaviour have been dismissed.DescriptionThis package provides a shim around PyGame that turns off the unwanted printing
behaviour with an environment variable. It is designed to be a simple drop in
replacement wherever you would use PyGame.There aremanual alternativeswhich have the benefit of reducing an external dependency, but this is simpler:Install bothpygameandpygamesilentinto your project.Replace any instances of these types of statements:import pygame→import pygamesilent as pygameimport pygame as pg→import pygamesilent as pgimport xxx from pygame→import xxx from pygamesilentVersions SupportedThis is expected to be cross platform. It has been tested on Windows 10 and
Linux.It is tested on Python 2.7, 3.5, 3.6 and 3.7.NoteThishas not been authorised by the PyGame team. The author is not associated with
them.You will still need to install and use PyGame, their documentation and
follow their licenses.You might
even like tocontribute to their project! Perhaps
you can then politely convince them not to put spam in stdio?
Package: pygame.snake
pygame.snakeSnake supports scenes through the@game.scenedecorator. This
README doesn't cover them though. Despite that, snake's scenes are
awesome, look out for the documentation for them when I make it!Snake has been designed with the absolute beginner in mind.
None of that fussing around withpygame.event.get(),pygame.display.set_mode(),pygame.image.load(), etc.In fact, you can make a game in snake withoutimport pygameanywhere! A lot of the following code snippets are actually entire
snake projects. It's that simple to use.importsnakegame=snake.Game()whileTrue:game.next_frame()game.assets.player.stamp((0,0))game.assets? That's theassets/folder automatically loaded
with file types detected and filtered into the right things for you.game.assets.playercould have beenassets/player.png. It might
also have beenassets/player.jpgor any other image format. Snake
doesn't care.That's boring. Let's get some user input going on:importsnakegame=snake.Game()whileTrue:events=game.next_frame()ifevents.keys.space:print("Space is pressed!")else:print("Space isn't pressed")That was easy. Notice how the keyboard was dropped intoevents.keys?
Let's have a look at mouse input:print("Mouse is at "+str(events.mouse.pos))Nice. I wonder if we can scroll?ifevents.scroll.up:print("Scroll up")Oh. Nice. My game's a little more advanced though. I'm going to need
some sprites. No worries.player=game.sprite(game.assets.player)whileTrue:game.next_frame()player.x+=1Too easy. Onto fonts:label=game.sprite(game.assets.my_font)whileTrue:events=game.next_frame()ifevents.keys.space:label.text="Space is pressed"else:label.text="Space is not pressed"Remember thatgame.assets.my_fontis going to beassets/my_font.ttf, so make sure you have a font file there.Quitting isn't even something that needs to be covered. It's handled
implicitly for you. No problems there.Now at the moment everything has been working with the origin, but
that's boring. Let's add an FPS counter in the top right corner.counter=game.sprite(game.assets.my_font)counter.stick=game.NEwhileTrue:game.next_frame()counter.text=str(round(game.fps,2))We've got a few new things here. The important part iscounter.stickwhich tells snake where to place the sprite.
North-east is the top right which is what we want. The default isgame.CENTRE. The other new thing isgame.fps. No surprises there;
it's the FPS.I don't like the fact the text is mushed right against the side of the
window though. Let's fix that:counter=game.sprite(game.assets.my_font,x=32,y=32)Now we're offsetting it by 32 pixels in both directions. Easy as
anything.
Package: pygame-spiel
Pygame_spiel: Pygame-based UI to play board Reinforcement Learning games from OpenSpielPygameSpiel is aPygame-based library to play board games from the libraryOpenSpielagainst AI algorithms.Installpipinstallpygame_spielVersion 0.1.0Games currently available:BreakthroughTic Tac ToeAI algorithms available:mcts, DQN (currently only for breakthrough)more to come...OverviewRun Pygame_spiel with:pygame_spielUse your mouse to select the cell (tic tac toe) or select pawn and destination cell (breakthrough).
Package: pygametext
Changelog:Fixed BugsAdded pgt.square() function (for more information look at the Elements section)pygametextThis Package adds UI Elements to PyGame.Installpip install pygametextImportimport pygametextInitiate pygametextpgt = pygametext.PGT(screen)Elementspgt.button(x,y,width,height,buttonColor,"Text",textColor,onClickFunction,onClickArguments,layer)-> Returns Truepgt.switch(x,y,width,height,buttonColor,"Text",textColor,activeFunction,activeArguments,layer)-> Returns Truepgt.checkbox(x,y,scale,color,activeFunction,activeArguments,layer)-> Returns Truepgt.text(x,y,"Text",textColor,textSize,layer)-> Returns Truepgt.square(x,y,width,height,color,layer)-> Returns Truepgt.textbox(x,y,width,height,textColor,layer)-> Returns TrueProcess inputs and eventsThis function needs to be called if you want that the elements on specified layer to be interactive.pgt.update(layer)Draw elements to screenThis function needs to be called if you want that the elements on specified layer to be drawn.pgt.draw(layer)Utitilty functionspgt.getLayer(layer)-> Returns list of PGT Objects on specified Layerpgt.clear(id,layer)-> Returns True or Falsepgt.rebuild(layer)-> Returns Trueimportpygameimportpygametextrunning=Truepygame.init()screen=pygame.display.set_mode((640,360))clock=pygame.time.Clock()pgt=pygametext.PGT(screen)# Define pygametext object.pgt.button(10,10,100,50,(255,0,0),"Hello!",(0,0,0),print,"Hello World!",0)# Add pgt Buttonpgt.button(120,10,100,50,(255,255,0),"Bye bye",(0,0,0),print,"Goodbye World!",0)# Add pgt Buttonpgt.text(10,70,"Simple pygametext example.",(0,120,0),20,0)# Add pgt Textdefupdate():# Update & Eventdevents=pygame.event.get()pgt.update(events,0)# Update all pgt elements from layer 0. Takes events arg to process some elements.foreventinevents:ifevent.type==pygame.QUIT:running=Falsepygame.quit()quit()defdraw():screen.fill((255,255,255))# Clear screenpgt.draw()# Draw all pgt elements from layer 0pygame.display.flip()whilerunning:update()draw()clock.tick(60)
Package: pygame-text-centering
PYGAME WITH TRUE CENTERINGShellpip install pygame-text-centeringPython#example.py

import pygame
from pgcentering import Button, BadButton, Text, TextButton

if __name__ == "__main__":
    
    pygame.init()
    clock = pygame.time.Clock()

    screen_dim = (800, 400)
    screen = pygame.display.set_mode(screen_dim)
    button_color = (200, 200, 200)
    button_dim = (300, 100)

    good_button_center = (screen_dim[0]//4, screen_dim[1]//4)
    good_button = Button(
        screen = screen,
        text = 'GOOD', 
        color = button_color, 
        center = good_button_center, 
        dim = button_dim)
    good_button.draw()

    bad_button_center = (screen_dim[0]*3//4, screen_dim[1]//4)
    bad_button = BadButton(
        screen = screen, 
        text = 'BAD', 
        color = button_color, 
        center = bad_button_center, 
        dim = button_dim)
    bad_button.draw()

    plain_text_center = (screen_dim[0]//4, screen_dim[1]*3//4)
    plain_text = Text(
        screen = screen,
        text = 'BUTTON',
        color = button_color,
        center = plain_text_center,
        font_size = 70)
    plain_text.draw()
    
    text_button_center = (screen_dim[0]*3//4, screen_dim[1]*3//4)
    text_button = TextButton(
        screen = screen,
        text = 'TEXT',
        color = button_color,
        center = text_button_center,
        font_size = 70)
    text_button.draw()

    while True:

        if good_button.is_clicked():
            print("I am a good button")

        if bad_button.is_clicked():
            print("I am a bad button")

        if text_button.is_clicked():
            print("I am a text button")
            text_button.erase_button()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                exit()
                
        clock.tick(60)
        pygame.display.update()WHAT A DIFFERENCE!
Package: pygame_toolbox
(Version 0.1.2)Written for Python 3.XUntested in Python 2.XSource repo ongithubIntroductionThis is a collection of useful code for anyone wanting to work with game
making in Python. Current code deals with menu creation and boardgame
like tile usage. For details on using the library please refer to the
examples page on github.Install InstructionsPygame Toolbox can now be downloaded via pip. Simply run pip install
pygame_toolbox.DependenciesThis library is dependant on the followingPygameContributorsIdeas and contributions are always welcome. Any found bugs or
enhancement suggestions should be posted in the issues tab.Aditional InformationLicensingThis project is distributed using the MIT licenseFor more licensing information read LICENSE on githubContact Info:This project does not have a mailing list and so the issues tab should
be the first point of contact if wishing to discuss the project. If you
have questions that you do not feel are relavent to the issues tab or
just want to let me know what you think about the library, feel free to
email me.Email:jbmilam343@gmail.com
Package: pygame-tools
PyGame ToolsThis is a package designed to make development in pygame easier my creating some classes that handle alot of the loopinstallationpip install pygame-toolsThe most important classGameScreenis a class that represents a 'screen' in the game and is meant to be inherited to be used.importpygamefrompygame_toolsimportGameScreen,PointclassExample(GameScreen):def__init__(self):pygame.init()real_size=Point(600,600)# size of window itselfsize=real_size/40# 1 pixel for every 40super().__init__(pygame.display.set_mode(real_size),real_size,size)defupdate(self):pygame.draw.line(self.screen,(255,255,255),(0,self.window_size.y/2),(self.window_size.x,self.window_size.y/2))example=Example()example.run()# This example shows a black screen with a white line through the center
Package: py-GameUI
py-GameUIA Python package to use GUI Widgets like Button, Textinput & Slider in pygame.Install using:pipinstallpy-GameUIDocumentationYou could check out the docs athttps://aman333nolawz.github.io/py-GameUI/Usageimportpygameimportpy_GameUIW,H=600,600screen=pygame.display.set_mode((W,H))elements=[py_GameUI.Button([10,10,100,100],text="Hello world",function=lambda:print("You clicked on the button"),),py_GameUI.Input_box([10,150,150,20]),py_GameUI.Slider(10,210,10,30),]whileTrue:screen.fill("#1c1c1c")foreventinpygame.event.get():ifevent.type==pygame.QUIT:pygame.quit()exit()forelementinelements:element.events(event)forelementinelements:element.draw(screen)pygame.display.flip()
Package: pygame-ui-mb
pygame-uiIntroduction & OverviewHere's my attempt at creating a fluidUser Interfacelibrary built forpygame 2+This project is current VERY EARLY in development, so there are probably loads of bugs that you'll experience when messing about with it, so feel free to open an issue or create a PR and fix the bug yourself :)How to useJust take a look in the repo and try out some of the example files - I suggest you look into how they work to get an idea of how you'd setup your own uis :)Warning: Someexamples/*.pyfiles may no longer be functional, as I've done quite a large rewrite of the mainWidget&Containercode. I'll try and get all the tests setup properly asap.Good Practice:examples/complex.pyis the most recent of theexamples/*.pyfiles, and it is therefor written the most efficiently and pythonic. I recommend you take a look through it so you can plan out how to setup your own interfaces.Here's what youshouldsee when you runexamples/complex.py, you can use the WASD keys to resize the Window WidgetFurther Code ExamplesA window with two stretching widgets, organised in a rowimportPygameUiWindow=PygameUi.WindowWidget=PygameUi.WidgetLayout=PygameUi.LayoutTags=pygameUi.widget_tags.Tags# initialise a main window,# and set its size to 300x200main_window=Window()main_window.size=(300,200)main_window.layout_direction=Tags.ROW# create two child widgets,# and set their fluid sizes to# have the same priority - so# they take up the same amount# of spacechild_left=Widget()child_left.fluid_size=(1,1)child_right=Widget()child_right.fluid_size=(1,1)main_window.add_children([child_left,child_right])# this is NOT all the code required-# you also need your basic pygame loop# and event management. If you're not# sure how that would be setup, I# recommend you look into some of the# example files to get a rough ideaLicensePlease make sure to read the LICENSE file before deciding to release your own versions of my code, also feel free to add a PR to change anything or fix anything up
Package: pygame-ui-toolkit
pygame-ui-toolkitpygame-ui-toolkit is a python library for easily creating UI elements with Pygame.It makes it easy to add buttons, sliders, text inputs and more UI components to any pygame project.InstallationRun the following command to install pygame-ui-toolkit via pip:pip install pygame-ui-toolkitUsageOnce installed, import the package into your project by entering the following line at the top of your script.import pygame_ui_toolkitThere is no official documentation for this package.The scripts in theexamplesdirectory should show you how to use the package. They detail the creation and use of all core UI elements and the presets.Docstrings and type hints have been included within the scripts in the project, which should outline what each function and class does alongside the kinds of arguments that should be passed into them.As a general tip, always remember to call an element'supdate()methodonce per frame. This is shown in the following example:import pygame
import pygame_ui_toolkit

# Create the button
button = pygame_ui_toolkit.button.RectButton(...)

# Main loop
while True:
    # Update the button
    button.update()

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            quit()Featurespygame-ui-toolkit offers the following features:UI Elements:These are the core user input elements that can be created using this library.ButtonsRectangle buttonsBordered rectangle buttonsCircle buttonsBordered circle buttonsPolygon buttonsBordered polygon buttonsAll of the above with textSlidersHorizontal slidersVertical slidersText InputsAll buttons (other than polygon buttons) can be used as text inputsTogglesTick boxTick box with text to the left or rightDropdown MenusRectangle dropdownsBordered rectangle dropdownsCircle dropdownsBordered circle dropdownsText BoxesAll button types can be used as a text boxPresets:These are additional functionalities added on top of the core UI elements.ButtonChanging colour when hovered over or clicked onChanging size when hovered over or clicked onSliderAutomatically updating text that displays the current slider valueText InputAutomatically change size when hovered or clicked and change colour when currently selected