Package: wingsys
IssuesYou can report issues inthe wingsys GitHub repository.Installationpip install wingsysWhat's newscreen.__init__has now thecheckIfCharargument.screen.__init__has now thecheckIfColorargument.screen.__init__has now thecheckIfBorderargument.All arguments namedforecolorare now namedforeColor.All arguments namedbackcolorare now namedbackColor.All arguments namedstdcharare now namedstdChar.All variables namedcurrxare now namedcurrX.All variables namedcurryare now namedcurrY.Documentationscreendef__init__(self,foreColor="WHITE",backColor="BLACK",width=32,height=16,border=["-","|","#","#","#","#"],stdChar=" ",checkIfChar=True,checkIfColor=True,checkIfBorder=True)screen=wingsys.screen()Creates a new screen.foreColor: The text color of the screen.backColor: The background color of the screen.width: The width of the screen.height: The height of the screen.border: The border of the screen (seeCustom Borders).stdChar: The character to fill the screen with.checkIfChar: If it should check ifstdCharis not a single char, returningSyntaxError("stdChar is not a single char").checkIfColor: If it should check ifforeColorandbackColorare notcolorama.Foreandcolorama.Backrespectively, returningSyntaxError(f"{foreColor} is not a valid attribute in colorama.ansi.ansiFore")andSyntaxError(f"{backColor} is not a valid attribute in colorama.ansi.ansiBack").checkIfBorder: If it should check if any element ofborderis not a single char, returningSyntaxError(f"border[{index}] is not a single char").defupdate(self,clear=True)screen.update()Shows the screen to the console and clears the screen ifclearis set toTrue.clear: Setting this toTruewill also clear the console before showing the screen.deffillChar(self,char)screen.fillChar("#")Fills the screen with a character. The color remains unchanged.char: The character to fill the screen with.deffillColor(self,fore,back)screen.fillColor("RED","GREEN")Changes the screen color. The characters remain unchanged.fore: The text color.back: The background color.deffill(self,char,fore,back)screen.fill("#","RED","GREEN")Fills the screen with a colored character.char: The character to fill the screen with.fore: The character's color.back: The background color.defcoordsToIndex(self,x,y)index=screen.coordsToIndex(10,10)Converts coordinates to the corresponding index (seeCoordinates and Indexes).x: The X position.y: The Y position.defindexToCoords(self,index)x,y=screen.indexToCoords(23)Converts an index to the corresponding coordinates (seeCoordinates and Indexes).index: The index.setPixeldefbyCoords(screen,x,y,value)wingsys.setPixel.byCoords(screen,10,10,"#")Sets the given coordinate to the value (seeCoordinates and Indexes).screen: The screen to write to.x: The X coordinate.y: The Y coordinate.value: The value the pixel should be set to.defbyIndex(screen,index,value)wingsys.setPixel.byIndex(screen,23,"#")Sets the given index to the value (seeCoordinates and Indexes).screen: The screen to write to.index: The index.value: The value the pixel should be set to.getPixeldefbyCoords(screen,x,y)pixel=wingsys.getPixel.byCoords(screen,10,10)Returns the value of the given coordinate (seeCoordinates and Indexes).screen: The screen.x: The X coordinate.y: The Y coordinate.defbyIndex(screen,index,value)pixel=wingsys.getPixel.byIndex(screen,23,"#")Returns the value of the given index (seeCoordinates and Indexes).screen: The screen.index: The index.setPixelColordefbyCoords(screen,x,y,fore,back)wingsys.setPixelColor.byCoords(screen,10,10,"RED","GREEN")Sets the given coordinate's color toforeandback(seeCoordinates and Indexes).screen: The screen to write to.x: The X coordinate.y: The Y coordinate.fore: The text color.back: The background color.defbyIndex(screen,index,fore,back)wingsys.setPixelColor.byIndex(screen,23,"RED","GREEN")Sets the given index's color to the value (seeCoordinates and Indexes).screen: The screen to write to.index: The index.fore: The text color.back: The background color.getPixelColordefbyCoords(screen,x,y)wingsys.getPixelColor.byCoords(screen,10,10)Gets the given coordinate's color (fore+back) (seeCoordinates and Indexes).screen: The screen.x: The X coordinate.y: The Y coordinate.defbyIndex(screen,index)wingsys.getPixelColor.byIndex(screen,23)Gets the given index's color (fore+back) (seeCoordinates and Indexes).screen: The screen.index: The index.keysdefwaitForKeys(key1="none",key2="none",key3="none",key4="none",key5="none",key6="none",key7="none",key8="none",key9="none",key10="none",key11="none",key12="none",key13="none",key14="none",key15="none",key16="none")key=wingsys.keys.waitForKeys("enter","space","up","down","left","right","w","s","a","d")Waits for any key that is in the arguments and returns the argument position (example:("enter", "space")if you press space it returns2but if you press enter it returns1).key1 ... key16: The key and its return code.spritedef__init__(self,x,y,char,fore,back)player=wingsys.sprite(10,10,"X","BLUE","MAGENTA")Creates a new sprite.x: The X position.y: The Y position.char: The sprite's character.fore: The char's color.back: The sprite's background color.defupdate(self,screen,update,clear)player.update(screen)Draws the sprite in the screen.screen: where to update the sprite.update: If it should automatically update the screen.clear: If it should clear the screen before updating. This will not do anything ifupdateis set tofalse.defsetChar(self,char)player.setChar("+")Sets the sprite's char to the given value.char: The char.defsetPos(self,x,y)player.setPos(11,11)Sets the player's position.x: The X coordinate.y: The Y coordinate.defchangePos(self,x,y)player.changePos(1,-1)Changes the sprite's position. (x += x,y += y)x: The X coordinate.y: The Y coordinate.defsetX(self,x)player.setX(11)Sets the sprite's X position.x: The X coordinate.defsetY(self,y)player.setY(11)Sets the sprite's Y position.y: The Y coordinate.defchangeX(self,x)player.changeX(1)Changes the sprite's X position.x: The X coordinate.defchangeY(self,y)player.changeY(-1)Changes the sprite's Y position.y: The Y coordinate.defsetColor(self,fore,back)player.setColor("BLUE","MAGENTA")Sets the sprite's color.fore: The sprite's color.back: The sprite's background color.consoledefclear()console.clear()Clears the console.textdefwrite(screen:screen,text:str,x,y,fore,back,update=True,clear=True)text.write(screen,"Hello World!",0,0,"BLACK","WHITE")Writes text to the screen.screen: Where to write the text.text: The text to write.x: The X coordinate.y: The Y coordinate.fore: The text's color.back: The background color.update: If it should automatically update the screen.clear: If it should clear the screen before updating. This will not do anything ifupdateis set tofalse.Coordinates and IndexesThescreenuses 2 ways to specify a position:coordinates(x,y) andindexes(index).Thecoordinatesuse thexandypositions to work.For example:############
#          #
#  X       #
#          #
#          #
#          #
############Xhas coordinates (2,2).The index is different. It directly uses theX's position in thescreen list.Xhas index12.This is how you calculate the index:#######
#01234#
#56789#
#######Custom BordersThe screen's border can be edited. This is how the border is printed around the screen content.scr=wingsys.screen(border=["1","2","3","4","5","6"],width=10,height=5)311111111114
2          2
2          2
2          2
2          2
2          2
511111111116