Login / Register 0 items for $0.00 Checkout Store

Yost Labs

Contact Us
  • Home
  • Applications
    • GPS Compromised Pedestrian Tracking
    • Ultra-fast IMUs – QGRAD2™ Firmware
    • Biomechanical Motion Sensing
    • QGRAD2™ vs. Kalman Filter
  • Products
    • All Products
    • Custom Solutions
    • 3-Space Sensors
    • PrioVR Dev Kit
    • Servo Controllers
    • QGRAD2 Sensor Fusion
  • Downloads
    • 3-Space Sensor Downloads
    • PrioVR Downloads
    • Other Downloads
    • Open Source License
  • Resources
  • Support
    • RMA Request
    • Privacy Policy
    • Customer Support
    • Delivery and Shipping
    • Warranty, Returns, and Repairs
    • Terms and Conditions
  • About Us
    • Careers
    • Leadership
    • Distributors
      • Find a Distributor
      • Become a Distributor

Category: Screen Graphics Module

PScreen Graphics Module

Downloads, Screen Graphics Module

Quick Links

  • General Information
  • Installers and Installation Instructions
  • Example Programs
  • Example Sprite
  • License Information
  • Reference to PScreen Functions

General Information

PScreen is a Python module that provides simple 2D drawing functions as well as mouse and keyboard I/O. So why use PScreen when there are many other APIs out there?

Simplicity.  PScreen lets you do more with less.  PScreen is small and concise.  With PScreen you can draw on the screen, handle keyboard and mouse input, play sounds and music with less lines of code.

Great for learners.  With PScreen you can learn by example!  Our simple code samples show you how to use PScreen by example.

Small amount of code.  It does not have hundreds of thousands of lines of code for things you won’t use anyway.  The core is kept simple, and extra things like GUI libraries, and effects are developed separately outside of pygame.

Portable.  PScreen runs on Windows, Linux and Mac OS X!

Pygame.   PScreen is built on pygame.  After mastering PScreen, you will be ready to dig in and create even more advanced games.

Installers and Installation Instructions

Download the full PScreen installer and run it. Alternatively, if the pyglet and pygame libraries are already installed on your computer, you can download just the individual installer for PScreen.  Pygame and pyglet can also be obtained from www.pygame.org and www.pyglet.org, respectively.

Version Description
PScreen Full Installer Includes the PScreen module and also the pygame/pyglet libraries.
PScreen Only Installer Includes just the PScreen module.

Example Programs

Program Name Description
Movement Demonstrates simple key input and movement.
Alpha and Text Demonstrates various shapes and alpha blending/transparency.
Mouse and Collision Demonstrates mouse movement and collision (requires the sprite below in order to run).

Example Sprite

 

Click to download this sprite that can be used in your own games.  Put it in the same directory as your Python script to use this with the sprite manipulation functions.

License Information

© 2004 – 2017 Yost Labs
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Reference to PScreen Functions

Function Class Function Name Usage
General Functions LoadScreen LoadScreen(resolution=(800, 600), fullscreen=False, selectedBackend=”pygame”): Initialize the window. The possible choices for selectedBackend are “pygame-basic”, “pygame”, and “pyglet”.
ClearScreen ClearScreen(color=(255, 255, 255, 255)): Fill the entire screen with the specified color. Should be placed at the top of the game loop.
UpdateScreen UpdateScreen(): Update the contents of the window. Should be placed at the end of the game loop.
UnloadScreen UnloadScreen(): Unload the screen and all associated resources.
Drawing Functions PixelSet PixelSet(x, y, color=(255, 255, 255, 255)): Color in the pixel at the specified position.
PixelGet PixelGet(x, y): Return a tuple describing the color at the specified position.
Line Line(x1, y1, x2, y2, color=(255, 255, 255, 255), linewidth=1): Draw a line from (x1, y1) to (x2, y2).
Rectangle Rectangle(x1, y1, x2, y2, color=(255, 255, 255, 255), linewidth=1): Draw a rectangle using (x1, y1) and (x2, y2) as two corners. If linewidth is zero, the rectangle will be filled.
Triangle Triangle(x1, y1, x2, y2, x3, y3, color=(255, 255, 255, 255), linewidth=1): Draw a triangle using (x1, y1), (x2, y2) and (x3, y3) as the corners. If linewidth is zero, the triangle will be filled.
Circle Circle(x, y, r, color=(255, 255, 255, 255), linewidth=1): Draw a circle at position (x, y) with radius r. If linewidth is zero, the circle will be filled.
Ellipse Ellipse(x, y, w, h, color=(255, 255, 255, 255), linewidth=1): Draw an ellipse at position (x, y) with width w and height h. If linewidth is zero, the ellipse will be filled.
Keyboard Functions KeyIsPressed KeyIsPressed(key): Returns true if this key is currently pressed. key can be a string; for example, “a”, “return”, and “escape” are all valid.
KeyIsNotPressed KeyIsNotPressed(key): Returns true if this key is NOT currently pressed.
KeyGetPressedList KeyGetPressedList(): Return a list of currently pressed keys.
Mouse Functions MouseGetButtonL MouseGetButtonL(): Returns True if the left mouse button is held down.
MouseGetButtonR MouseGetButtonR(): Returns True if the right mouse button is held down.
MouseGetButtonM MouseGetButtonM(): Returns True if the middle mouse button is held down.
MouseGetX MouseGetX(): Returns the x position of the mouse.
MouseGetY MouseGetY(): Returns the y position of the mouse.
MouseGetPosition MouseGetPosition(): Returns a tuple containing the x and y positions of the mouse.
MouseGetButtons MouseGetButtons(): Returns a 3-element tuple describing the state of each mouse button, such as (left, middle, right). Each element will be True or False.
Font Functions FontSelect FontSelect(fontName=”Arial”, fontSize=”24″): Set the current font. Must be done prior to rendering text.
FontWrite FontWrite(x, y, text, color=(255, 255, 255, 255)): Draw text at the specified position. Currently, the alpha value (the last color parameter) is not supported in pygame.
Music Functions MusicLoad MusicLoad(filename): Load filename as the current background music. Multiple formats are supported, including .mp3, .wav, and .ogg.
MusicPlay MusicPlay(): Play the currently loaded background music.
MusicPause MusicPause(): Pause the currently playing background music.
MusicUnPause MusicUnPause(): Unpause the currently loaded background music.
MusicFade MusicFade(seconds): Fade out the currently playing background music over the given time.
MusicSetVolume MusicSetVolume(volumePercent=40): Set the volume of the currently loaded background music.
MusicGetVolume MusicGetVolume(): Return the volume of the currently loaded background music.
MusicStop MusicStop(): Stop the currently playing background music.
Sound Functions SoundLoad SoundLoad(filename, slot): Load the specified sound into one of 256 slots (slot should be 0 – 255).
SoundPlay SoundPlay(slot): Play the sound stored in the given slot.
SoundStop SoundStop(slot): Stop the sound stored in the given slot.
SoundSetVolume SoundSetVolume(slot, volumePercent): Set the volume of the sound in the given slot.
Sprite Functions SpriteLoad SpriteLoad(filename, slot): Load the specified sprite into one of 256 slots (slot should be 0 – 255).
SpriteRender SpriteRender(x, y, slot, rotation=0, scale=1, flipH=False, flipV=False, alpha=255): Render the sprite in the specified slot at the specified position. Rotation specifies a counterclockwise rotation in angles; scale specifies a scaling factor in both dimensions; flipH and flipV flip the sprite horizontally and vertically, respectively. The alpha parameter is not currently supported in pygame.
SpriteSimpleRender SpriteSimpleRender(x, y, slot): A simpler, quicker method of rendering a sprite.
SpriteWidth SpriteWidth(slot): Return the width of the sprite in the specified slot.
SpriteHeight SpriteHeight(slot): Return the height of the sprite in the specified slot.
Frame Rate Functions FrameGetLimit FrameGetLimit(): Returns the current frames per second.
FrameSetLimit FrameSetLimit(fps): Cap the framerate at the specified frames per second.
FrameDelay FrameDelay(): Ticks the internal clock object; this should be called during every iteration of the game loop. The function returns a value that indicates the amount of time elapsed since the last update.

 

Latest News and Updates

  • Yost Labs introduces new high performance, low cost, ultra-miniature AHRS
    New LX model provides Aerospace grade performance at consumer grade pricing. PORTSMOUTH, Ohio—Yost Labs again raises the bar for advanced inertial motion tracking with their newest innovation, the 3-Space Sensor™ LX, an ultra-miniature Attitude & Heading Reference System (AHRS) with embedded pedestrian tracking […]
  • Yost Labs named among the “Best University Startups 2017”
    Startup making strides in biomechanical tracking with applications in rehab and virtual reality Yost Labs, leader in advanced inertial motion tracking, is proud to be recognized by the National Council of Entrepreneurial Tech Transfer (NCET2) as one of the Best University Startups of […]
  • AHRS/IMU applications for the world’s fastest inertial motion sensor technology
    Yost Labs’ team lives and breathes motion sensor technology. Our passion is creating innovative products and systems that advance the art and push the boundaries of what is possible with AHRS/IMUs, and we have been successful in that goal. However, it’s not until […]

Categories

  • 3-Space
  • Downloads
  • News and Updates
  • Screen Graphics Module
  • ServoCenter
Yost Labs Inc
About Us
News
My Account / Register
  • Facebook
  • Twitter
  • Youtube
  • Linkedin
Quick Links
Downloads
Delivery / Shipping
Warranty / Returns / Repair
Terms and Conditions
Contact Us
Technical Support:
Support@yostlabs.com

Sales / Quotes:
Sales@yostlabs.com

Custom Project Inquiries:
Sales@yostlabs.com

Phone Number:
(740) 876-4936

Copyright © Yost Labs