Initially created for the Python User Group Freiburg meeting on December 11, 2013. Last updated November 2014.
Source, including codesamples, available at https://github.com/Felix11H/LaTeX-presentations-pygame_intro
This slide introduct about pygame and show some technique that used in demo game Mario of Happycodyng Group.
More info at: http://tech.blog.framgia.com/vn/
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on PyGame Tutorial covers all the basic aspects of creating and running your own simple game. It establishes the concepts needed like images, sounds, geometry etc needed to build your own games using Python. Below is the agenda of this PPT:
What is PyGame?
Installing PyGame
Anatomy of PyGame
Working with Images
Working with Sounds
Working with Geometric Drawings
Working with Fonts and Text
Understanding Input Methods
Understanding Scene Logic
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
( ** Python Certification Training: https://www.edureka.co/python ** )
This Edureka PPT on Tkinter tutorial covers all the basic aspects of creating and making use of your own simple Graphical User Interface (GUI) using Python. It establishes all of the concepts needed to get started with building your own user interfaces while coding in Python.
This slide introduct about pygame and show some technique that used in demo game Mario of Happycodyng Group.
More info at: http://tech.blog.framgia.com/vn/
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on PyGame Tutorial covers all the basic aspects of creating and running your own simple game. It establishes the concepts needed like images, sounds, geometry etc needed to build your own games using Python. Below is the agenda of this PPT:
What is PyGame?
Installing PyGame
Anatomy of PyGame
Working with Images
Working with Sounds
Working with Geometric Drawings
Working with Fonts and Text
Understanding Input Methods
Understanding Scene Logic
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
( ** Python Certification Training: https://www.edureka.co/python ** )
This Edureka PPT on Tkinter tutorial covers all the basic aspects of creating and making use of your own simple Graphical User Interface (GUI) using Python. It establishes all of the concepts needed to get started with building your own user interfaces while coding in Python.
What is Multithreading In Python | Python Multithreading Tutorial | EdurekaEdureka!
YouTube Link: https://youtu.be/JnFfp81VbOs
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Multithreading in Python'' will help you understand the concept of threading in python. Below are the topics covered in this live PPT:
What is multitasking in Python?
Types of multitasking
What is a thread?
How to achieve multithreading in Python?
When to use multithreading?
How to create threads in Python?
Advantages of multithreading
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
Custom SRP and graphics workflows - Unite Copenhagen 2019Unity Technologies
Battle Planet - Judgement Day is a unique game in the sense that it's played entirely on a single sphere (the planet). Levels are fully procedural and fully destructible. This structure created a few big challenges in terms of rendering, which were solved by writing a custom Scriptable Render Pipeline for the game. This session provides an overview of the game's rendering features and how they were implemented using SRP. It includes a few examples of how performance issues influenced the design of the pipeline as well as a discussion about shader programming and design patterns.
Speaker:
Henning Steinbock - Threaks
Session available here: https://youtu.be/91zUwJwkXNQ
Python 101: Python for Absolute Beginners (PyTexas 2014)Paige Bailey
If you're absolutely new to Python, and to programming in general, this is the place to start!
Here's the breakdown: by the end of this workshop, you'll have Python downloaded onto your personal machine; have a general idea of what Python can help you do; be pointed in the direction of some excellent practice materials; and have a basic understanding of the syntax of the language.
Please don't forget to bring your laptop!
Audience: "Python 101" is geared toward individuals who are new to programming. If you've had some programming experience (shell scripting, MATLAB, Ruby, etc.), then you'll probably want to check out the more intermediate workshop, "Python 101++".
How to download and install Python - lesson 2Shohel Rana
We will follow some steps to complete the installation process of Python.
1. Download the Python installer from Python website.
2. By double clicking install it.
3. Set the path for Python
4. Check Python is working very well.
5. If you missed the path setting for Python, then uninstall it and re install Python.
YouTube Link: https://youtu.be/mHezNgNBnuA
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Date and Time in Python' will train you to use the datetime and time modules to fetch, set and modify date and time in python.
Below are the topics covered in this PPT:
The time module
Built-in functions
Examples
The datetime module
Built-in functions
Examples
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
Snake game powerpoint presentation by rohit malavRohit malav
snake game
Snake is the common name for a video game concept where the player maneuvers a line which grows in length, with the line itself being a primary obstacle.Snake is the common name for a video game concept where the player maneuvers a line which grows in length, with the line itself being a primary obstacle. The concept originated in the 1976 arcade game Blockade, and the ease of implementing Snake has led to hundreds of versions (some of which have the word snake or worm in the title) for many platforms. After a variant was preloaded on Nokia mobile phones in 1998, there was a resurgence of interest in the snake concept as it found a larger audience. There are over 300 Snake-like games for iOS aloneSnake is the common name for a video game concept where the player maneuvers a line which grows in length, with the line itself being a primary obstacle. The concept originated in the 1976 arcade game Blockade, and the ease of implementing Snake has led to hundreds of versions (some of which have the word snake or worm in the title) for many platforms. After a variant was preloaded on Nokia mobile phones in 1998, there was a resurgence of interest in the snake concept as it found a larger audience. There are over 300 Snake-like games for iOS alone.
Python, the Language of Science and Engineering for EngineersBoey Pak Cheong
A talk given in November 2016 at IEM Malaysia to engineers, who are new to Python, a broad perspective of what Python is, why it is important to learn it and how it can help in solving/visualization of engineering and scientific tasks and problems.
Computer graphics lab report with code in cppAlamgir Hossain
This is the lab report for computer graphics in cpp language. Basically this course is only for the computer science and engineering students.
Problem list:
1.Program for the generation of Bresenham Line Drawing.
2. Program for the generation of Digital Differential Analyzer (DDA) Line Drawing.
3. Program for the generation of Midpoint Circle Drawing.
4. Program for the generation of Midpoint Ellipse Drawing.
5. Program for the generation of Translating an object.
6. Program for the generation of Rotating an Object.
7. Program for the generation of scaling an object.
All programs are coaded in cpp language .
Mip stands for the Latin multim im parvo, meaning "many things in a small place." Mipmapping uses some clever methods to pack image data into memory. When using mipmapping, OpenGL automatically determines which texture map to use based on the size (in pixels) of the object being mapped.
Tutorial on the usage of Sumatra (http://neuralensemble.org/sumatra/) with git. Presented at the Bernstein Center for Computational Neuroscience in May 2015.
Minecraft in 500 lines of Python with PygletRichard Donkin
A short walkthrough of some of the code from an impressive 500 line Python game - a simple version of Minecraft, using the Pyglet 3D library. Links to resources for Pyglet and Python gaming generally.
What is Multithreading In Python | Python Multithreading Tutorial | EdurekaEdureka!
YouTube Link: https://youtu.be/JnFfp81VbOs
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Multithreading in Python'' will help you understand the concept of threading in python. Below are the topics covered in this live PPT:
What is multitasking in Python?
Types of multitasking
What is a thread?
How to achieve multithreading in Python?
When to use multithreading?
How to create threads in Python?
Advantages of multithreading
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
Custom SRP and graphics workflows - Unite Copenhagen 2019Unity Technologies
Battle Planet - Judgement Day is a unique game in the sense that it's played entirely on a single sphere (the planet). Levels are fully procedural and fully destructible. This structure created a few big challenges in terms of rendering, which were solved by writing a custom Scriptable Render Pipeline for the game. This session provides an overview of the game's rendering features and how they were implemented using SRP. It includes a few examples of how performance issues influenced the design of the pipeline as well as a discussion about shader programming and design patterns.
Speaker:
Henning Steinbock - Threaks
Session available here: https://youtu.be/91zUwJwkXNQ
Python 101: Python for Absolute Beginners (PyTexas 2014)Paige Bailey
If you're absolutely new to Python, and to programming in general, this is the place to start!
Here's the breakdown: by the end of this workshop, you'll have Python downloaded onto your personal machine; have a general idea of what Python can help you do; be pointed in the direction of some excellent practice materials; and have a basic understanding of the syntax of the language.
Please don't forget to bring your laptop!
Audience: "Python 101" is geared toward individuals who are new to programming. If you've had some programming experience (shell scripting, MATLAB, Ruby, etc.), then you'll probably want to check out the more intermediate workshop, "Python 101++".
How to download and install Python - lesson 2Shohel Rana
We will follow some steps to complete the installation process of Python.
1. Download the Python installer from Python website.
2. By double clicking install it.
3. Set the path for Python
4. Check Python is working very well.
5. If you missed the path setting for Python, then uninstall it and re install Python.
YouTube Link: https://youtu.be/mHezNgNBnuA
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Date and Time in Python' will train you to use the datetime and time modules to fetch, set and modify date and time in python.
Below are the topics covered in this PPT:
The time module
Built-in functions
Examples
The datetime module
Built-in functions
Examples
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
Snake game powerpoint presentation by rohit malavRohit malav
snake game
Snake is the common name for a video game concept where the player maneuvers a line which grows in length, with the line itself being a primary obstacle.Snake is the common name for a video game concept where the player maneuvers a line which grows in length, with the line itself being a primary obstacle. The concept originated in the 1976 arcade game Blockade, and the ease of implementing Snake has led to hundreds of versions (some of which have the word snake or worm in the title) for many platforms. After a variant was preloaded on Nokia mobile phones in 1998, there was a resurgence of interest in the snake concept as it found a larger audience. There are over 300 Snake-like games for iOS aloneSnake is the common name for a video game concept where the player maneuvers a line which grows in length, with the line itself being a primary obstacle. The concept originated in the 1976 arcade game Blockade, and the ease of implementing Snake has led to hundreds of versions (some of which have the word snake or worm in the title) for many platforms. After a variant was preloaded on Nokia mobile phones in 1998, there was a resurgence of interest in the snake concept as it found a larger audience. There are over 300 Snake-like games for iOS alone.
Python, the Language of Science and Engineering for EngineersBoey Pak Cheong
A talk given in November 2016 at IEM Malaysia to engineers, who are new to Python, a broad perspective of what Python is, why it is important to learn it and how it can help in solving/visualization of engineering and scientific tasks and problems.
Computer graphics lab report with code in cppAlamgir Hossain
This is the lab report for computer graphics in cpp language. Basically this course is only for the computer science and engineering students.
Problem list:
1.Program for the generation of Bresenham Line Drawing.
2. Program for the generation of Digital Differential Analyzer (DDA) Line Drawing.
3. Program for the generation of Midpoint Circle Drawing.
4. Program for the generation of Midpoint Ellipse Drawing.
5. Program for the generation of Translating an object.
6. Program for the generation of Rotating an Object.
7. Program for the generation of scaling an object.
All programs are coaded in cpp language .
Mip stands for the Latin multim im parvo, meaning "many things in a small place." Mipmapping uses some clever methods to pack image data into memory. When using mipmapping, OpenGL automatically determines which texture map to use based on the size (in pixels) of the object being mapped.
Tutorial on the usage of Sumatra (http://neuralensemble.org/sumatra/) with git. Presented at the Bernstein Center for Computational Neuroscience in May 2015.
Minecraft in 500 lines of Python with PygletRichard Donkin
A short walkthrough of some of the code from an impressive 500 line Python game - a simple version of Minecraft, using the Pyglet 3D library. Links to resources for Pyglet and Python gaming generally.
Спикер: Денис Ковалев, Software Developer в DataArt.
Тема: «Python в игровой индустрии».
«Расскажу о библиотеках и фреймворках Python, используемых для создания игр.»
О спикере: закончил физический факультет ВГУ, после чего пришел в IT, где работает уже более пяти лет. За это время успел поработать и с Perl и С/С++, и с Python и Java. Специализируется на работе с Linux и базами данных.
Видео: https://www.youtube.com/watch?v=RkcX6ZWU56s#t=2207
__
Сайт: http://www.dataart.ru/
Facebook: https://www.facebook.com/DataArt.Enjoy
Vkontakte: http://vk.com/dataart_enjoy
Twitter: https://twitter.com/DataArt_Enjoy
Teaching Python to 9 Year Old Girl - map moverCraig Oda
Curriculum to teach 9 year old girl python. It works. This exact lesson has been tested multiple times with a 9 year old girl. It is known to work and was continually refined whenever she encountered a problem. This method is based on a series of repetitive drills and is part of the PyChildren video series. Links to the first three lessons are included at the end of the deck.
JavaScript Advanced - Useful methods to power up your codeLaurence Svekis ✔
Get this Course
https://www.udemy.com/javascript-course-plus/?couponCode=SLIDESHARE
Useful methods and JavaScript code snippets power up your code and make even more happen with it.
This course is perfect for anyone who has fundamental JavaScript experience and wants to move to the next level. Use and apply more advanced code, and do more with JavaScript.
Everything you need to learn more about JavaScript
Source code is included
60+ page Downloadable PDF guide with resources and code snippets
3 Challenges to get you coding try the code
demonstrating useful JavaScript methods that can power up your code and make even more happen with it.
Course lessons will cover
JavaScript Number Methods
JavaScript String Methods
JavaScript Math - including math random
DOMContentLoaded - DOM ready when the document has loaded.
JavaScript Date - Date methods and how to get set and use date.
JavaScript parse and stringify - strings to objects back to strings
JavaScript LocalStorage - store variables in the user browser
JavaScript getBoundingClientRect() - get the dimensions of an element
JavaScript Timers setTimeout() setInterval() requestAnimationFrame() - Run code when you want too
encodeURIComponent - encoding made easy
Regex - so powerful use it to get values from your string
prototype - extend JavaScript objects with customized powers
Try and catch - perfect for error and testing
Fetch xHR requests - bring content in from servers
and more
No libraries, no shortcuts just learning JavaScript making it DYNAMIC and INTERACTIVE web application.
Step by step learning with all steps included.
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!SOFTTECHHUB
As the digital landscape continually evolves, operating systems play a critical role in shaping user experiences and productivity. The launch of Nitrux Linux 3.5.0 marks a significant milestone, offering a robust alternative to traditional systems such as Windows 11. This article delves into the essence of Nitrux Linux 3.5.0, exploring its unique features, advantages, and how it stands as a compelling choice for both casual users and tech enthusiasts.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
Pygame presentation
1. Introduction to
Presented by
Felix Homann
@Felix11H
felix11h.github.io/
Slides
Slideshare:
tiny.cc/pyg-into
Source:
tiny.cc/pyg-into-github
References
- Pygame website: pygame.org
- Richard Jones' Pygame lecture:
- recording on Youtube
- code samples on Bitbucket
- List of keys:
pygame.org/docs/ref/key.html
This work is licensed under a Creative Commons Attribution 4.0 International License.
2. http://www.pygame.org
Pygame is a Python wrapper around the SDL library (Simple
DirectMedia Layer) with a few unique libraries with an emphasis on
game programming, written by Pete Shinners.
3. From the FAQ
Does not require OpenGL
Uses either opengl, directx, windib, X11, linux frame buer,
and many other dierent backends... including an ASCII art
backend!
Truly portable
Supports Linux, Windows, Windows CE, BeOS, MacOS, Mac
OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX,
and QNX . . .
Silliness built in!
4. A simple Pygame example
1 import pygame
2
3 pygame.init()
4 screen = pygame.display.set_mode((640, 480))
5
6 color = [(0,0,0),(255,255,255)]
7 running = True
8
9 while running:
10 for event in pygame.event.get():
11 if event.type == pygame.QUIT:
12 running = False
13 if event.type == pygame.KEYDOWN:
14 color[0], color[1] = color[1],color[0]
15
16 screen.fill(color[0])
17 pygame.display.flip()
01-simple_pygame.py
5. What each element does: Importing Initializing
import pygame
to import the Pygame module.
from pygame.locals import *
Optional. Puts limited set of constant and function in the global
namespace.
pygame.init()
to initialize Pygame's modules (e.g. pygame.font). Not always
needed, but recommended in any case.
6. What each element does: Setting Window Screen
screen = pygame.display.set_mode((640, 480))
initializes a window with dimensions 640 480 and returns the
screen object.
Everything to be displayed needs to be drawn on the screen.
8. Initializing a Pygame window - Extended
1 import pygame
2
3 pygame.init()
4 screen = pygame.display.set_mode((640, 480))
5
6 running = True
7 while running:
8 for event in pygame.event.get():
9 if event.type == pygame.QUIT:
10 running = False
9. What each element does: The Main Loop
1 running = True
2 while running:
3 for event in pygame.event.get():
4 if event.type == pygame.QUIT:
5 running = False
6 if event.type == pygame.KEYDOWN:
7 color[0], color[1] = color[1],color[0]
8
9 screen.fill(color[0])
10 pygame.display.flip()
is the main loop of the game.
I listen to events ! respond
I proceed the game
I draw on the screen
I stop when done
10. A framework for your Pygames
1 import pygame
2
3 pygame.init()
4 screen = pygame.display.set_mode((640, 480))
5
6 running = True
7 while running:
8 for event in pygame.event.get():
9 if event.type == pygame.QUIT:
10 running = False
11 if event.type == pygame.KEYDOWN:
12 react_to_user_input()
13
14 do_things_the_game_does()
15 draw_everything_on_the_screen()
Next:
I Drawing
I User Input
I Game Events
12. Drawing on the screen I
Filling the screen with a color:
1 blue = (0,0,255)
2 screen.fill(blue)
3 pygame.display.flip()
After all drawing is done, call display.flip() to update the
display.
Use pygame.draw to draw geometric shapes. A circle:
1 red = (255,0,0)
2 # position (320,240), radius = 50
3 pygame.draw.circle(screen, red, (320,240), 50)
13. Drawing on the screen II
Geometric shapes available for pygame.draw:
circle(Surface, color, pos, radius, width=0)
polygon(Surface, color, pointlist, width=0)
line(Surface, color, start, end, width= 1)
rect(Surface, color, Rect, width=0)
ellipse(Surface, color, Rect, width=0)
Example:
1 red = (255,0,0)
2 pygame.draw.line(screen, red, (10,50),(30,50),10)
21. Events
get all events in Pygame's event queue
pygame.event.get()
usually used as
1 for event in pygame.event.get():
2 if event.type == YourEvent:
3 react_to_your_event()
22. Event types
Some of the most important event types are:
pygame.QUIT
pygame.KEYDOWN
pygame.KEYUP
pygame.USEREVENT
With
from pygame.locals import *
from earlier, pre
24. Events
React to KEYDOWN event:
1 while running:
2 for event in pygame.event.get():
3 if event.type == KEYDOWN:
4 react_to_key()
Which key? ! if event type is KEYDOWN or KEYUP event has
attribute key.
1 for event in pygame.event.get():
2 if event.type == KEYDOWN:
3 if event.key == K_ESCAPE:
4 running = False
25. Pygame Keys
Some of the most important keys are:
K_RETURN
K_SPACE
K_ESCAPE
K_UP, K_DOWN, K_LEFT, K_RIGHT
K_a, K_b, ...
K_0, K_1, ...
Full list of keys: http://www.pygame.org/docs/ref/key.html
26. Getting continuous input
KEYDOWN is a unique event.
key = pygame.key.get_pressed()
to get keys currently pressed.
if key[pygame.K_UP]:
move_up()
to check and react on a speci
28. A user input example
1 color = [0,0,0]
2
3 while running:
4 for event in pygame.event.get():
5 if event.type == pygame.QUIT:
6 running = False
7 if event.type == KEYDOWN and event.key == K_SPACE:
8 color = [0,0,0]
9
10 keys = pygame.key.get_pressed()
11 if keys[K_UP]:
12 color = [(rgb+1)%256 for rgb in color]
13
14 screen.fill(color)
15 pygame.display.flip()
05-user_input.py
33. Sprites
Pygame's sprite class gives convenient options for handling
interactive graphical objects.
If you want to draw and move (or manipulate) and object, make it
a sprite.
Sprites
can be grouped together
are easily drawn to a surface (even as a group!)
have an update method that can be modi
39. Sprite groups
new_sprite_group = pygame.sprite.Group(sprite1)
to create a new sprite group containing sprite sprite1.
new_sprite_group.add(sprite2)
to add another sprite later.
Group updating and drawing:
1 #inside main loop:
2
3 new_sprite_group.update() #game events
4 new_sprite_group.draw() #drawing
40. Framework for working with sprite groups
1 class NewSprite(pygame.sp...
2 #defining a new sprite
3
4 newsprite = NewSprite()
5 sprites = pygame.sprite.Group()
6 sprites.add(newsprite)
7
8 while running:
9 for event in ...
10
11 sprites.update() #game events
12 sprites.draw()
13 pygame.display.flip()
42. Working example: Transparency
By default pygame.Surface is black. For transparency:
1 class Circle(pygame.sprite.Sprite):
2 def __init__(self):
3 pygame.sprite.Sprite.__init__(self)
4 self.image = pygame.Surface([100, 100], pygame.SRCALPHA, 32)
5 pygame.draw.circle(self.image, blue, (50, 50), 50)
6 self.image = self.image.convert_alpha()
08-circle.py
43. Sprite Collision Detection
pygame.sprite.collide_rect(left, right)
to detect collision between two sprites
pygame.sprite.spritecollideany(sprite, group)
to test if the given sprite intersects with any sprites in a Group
44. Have fun with !
Presented by
Felix Homann
@Felix11H
felix11h.github.io/
Slides
Slideshare:
tiny.cc/pyg-into
Source:
tiny.cc/pyg-into-github
References
- Pygame website: pygame.org
- Richard Jones' Pygame lecture:
- recording on Youtube
- code samples on Bitbucket
- List of keys:
pygame.org/docs/ref/key.html
This work is licensed under a Creative Commons Attribution 4.0 International License.