Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Provides a cartesian plane canvas able to move and zooming in pygame.
With this module you can use cartesian cordinates to draw forms and create objects in a cartesian plane. Which is useful for simple 2D graphics.
pip install cartesian-plane
cartesian_plane = CartesianPlane(screen)
Creates a CartesianPlane canvas.
Arguments:
Returns a CartesianPlane object.
screen_pos = cartesian_plane.plane_to_screen(point)
Converts a cartesian point to a screen position.
Arguments:
Returns returns a screen position as a list [x, y].
cartesian_point = cartesian_plane.screen_to_plane(screen_pos)
Converts a screen position to a cartesian point.
Arguments:
Returns a cartesian point as a list [x, y].
scaled_dimention = cartesian_plane.scale(dimension)
Scales a dimension to the current zoom level.
Arguments:
Returns a scaled dimension.
cartesian_plane.debug(name1=value1, name2=value2, ...)
Add debug information to the Cartesian Plane. On each update() call, the debug information will be drawn.
for event in pygame.event.get():
# event handling
...
cartesian_plane.event_handling(event)
This function is used on the event loop. It will handle the events of move and zooming the Cartesian Plane.
cartesian_plane.update()
updates the Cartesian Plane and draws the objects.
circle = Circle(plane, color, center, radius, width)
Creates a Circle object. The circle is automated drawn on each call of the update() function.
Arguments:
rect = Rect(plane, color, rect, width)
Creates a Rectangle object. The rectangle is automated drawn on each call of the update() function.
Arguments:
line = Line(plane, color, start, end, width)
Creates a Line object. The line is automated drawn on each call of the update() function.
Arguments:
path = Path(plane, color, *points, length = 100)
Creates a Path object. The path is automated drawn on each call of the update() function.
Arguments:
path.add_points(*points)
adds points to the path.
Arguments:
This class is used to draw a shape on the screen.
draw.circle(plane, color, center, radius, width)
Draws a circle on the screen.
Arguments:
draw.rect(plane, color, rect, width)
Draws a rectangle on the screen.
Arguments:
draw.line(plane, color, start, end, width)
Draws a line on the screen.
Arguments:
# Objects.py
import pygame
import cartesianPlane
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
YELLOW = (255, 255, 0)
# Set up the window
pygame.init()
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption('Cartesian Plane')
clock = pygame.time.Clock()
plane = cartesianPlane.CartesianPlane(screen)
circle = cartesianPlane.Circle(plane, RED, (0, 0), 10)
rect = cartesianPlane.Rect(plane, GREEN, [20, 10, 10, 10])
line = cartesianPlane.Line(plane, BLUE, [40, 0], [10, 10])
path = cartesianPlane.Path(plane, YELLOW, [0, 0], [10, 10], [20, 20])
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT or event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
pygame.quit()
quit()
plane.event_handling(event)
plane.debug(
fps=f'{clock.get_fps():.1f}'
)
# Update the plane
plane.update()
cartesianPlane.draw.circle(plane, GREEN, (15, 15), 1)
cartesianPlane.draw.rect(plane, BLUE, (25, 25, 10, 10), 1)
cartesianPlane.draw.line(plane, YELLOW, (35, 35), (45, 45))
clock.tick()
# Update the screen
pygame.display.update()
# Senoid.py
import pygame
import cartesianPlane
from math import sin
RED = (255, 0, 0)
pygame.init()
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption('Senoid')
clock = pygame.time.Clock()
plane = cartesianPlane.CartesianPlane(screen)
senoid = cartesianPlane.Path(plane, RED, [0, 0], length=0)
x = 0
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT or event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
pygame.quit()
quit()
plane.event_handling(event)
plane.debug(
fps=f'{clock.get_fps():.1f}',
points=len(senoid.path)
)
# Update the plane
plane.update()
clock.tick(60)
senoid.add_points([x * 100, sin(x) * 100])
x += 0.01
# Update the screen
pygame.display.update()
FAQs
Provides a cartesian plane canvas able to move and zooming in pygame.
We found that cartesian-plane demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.