Python Language

Total Page:16

File Type:pdf, Size:1020Kb

Python Language Python Language #python Table of Contents About 1 Chapter 1: Getting started with Python Language 2 Remarks 2 Versions 3 Python 3.x 3 Python 2.x 3 Examples 4 Getting Started 4 Verify if Python is installed 4 Hello, World in Python using IDLE 5 Hello World Python file 5 Launch an interactive Python shell 6 Other Online Shells 7 Run commands as a string 7 Shells and Beyond 8 Creating variables and assigning values 8 User Input 12 IDLE - Python GUI 13 Troubleshooting 14 Datatypes 15 Built-in Types 15 Booleans 15 Numbers 15 Strings 16 Sequences and collections 16 Built-in constants 17 Testing the type of variables 18 Converting between datatypes 18 Explicit string type at definition of literals 19 Mutable and Immutable Data Types 19 Built in Modules and Functions 20 Block Indentation 24 Spaces vs. Tabs 25 Collection Types 25 Help Utility 30 Creating a module 31 String function - str() and repr() 32 repr() 33 str() 33 Installing external modules using pip 34 Finding / installing a package 34 Upgrading installed packages 34 Upgrading pip 35 Installation of Python 2.7.x and 3.x 35 Chapter 2: *args and **kwargs 38 Remarks 38 h11 38 h12 38 h13 38 Examples 39 Using *args when writing functions 39 Using **kwargs when writing functions 39 Using *args when calling functions 40 Using **kwargs when calling functions 41 Using *args when calling functions 41 Keyword-only and Keyword-required arguments 42 Populating kwarg values with a dictionary 42 **kwargs and default values 42 Chapter 3: 2to3 tool 43 Syntax 43 Parameters 43 Remarks 44 Examples 44 Basic Usage 44 Unix 44 Windows 44 Unix 45 Windows 45 Chapter 4: Abstract Base Classes (abc) 46 Examples 46 Setting the ABCMeta metaclass 46 Why/How to use ABCMeta and @abstractmethod 47 Chapter 5: Abstract syntax tree 49 Examples 49 Analyze functions in a python script 49 Chapter 6: Accessing Python source code and bytecode 51 Examples 51 Display the bytecode of a function 51 Exploring the code object of a function 51 Display the source code of an object 51 Objects that are not built-in 51 Objects defined interactively 52 Built-in objects 52 Chapter 7: Alternatives to switch statement from other languages 54 Remarks 54 Examples 54 Use what the language offers: the if/else construct. 54 Use a dict of functions 54 Use class introspection 55 Using a context manager 56 Chapter 8: ArcPy 58 Remarks 58 Examples 58 Printing one field's value for all rows of feature class in file geodatabase using Search 58 createDissolvedGDB to create a file gdb on the workspace 58 Chapter 9: Arrays 59 Introduction 59 Parameters 59 Examples 59 Basic Introduction to Arrays 59 Access individual elements through indexes 60 Append any value to the array using append() method 61 Insert value in an array using insert() method 61 Extend python array using extend() method 61 Add items from list into array using fromlist() method 61 Remove any array element using remove() method 61 Remove last array element using pop() method 62 Fetch any element through its index using index() method 62 Reverse a python array using reverse() method 62 Get array buffer information through buffer_info() method 62 Check for number of occurrences of an element using count() method 62 Convert array to string using tostring() method 63 Convert array to a python list with same elements using tolist() method 63 Append a string to char array using fromstring() method 63 Chapter 10: Asyncio Module 64 Examples 64 Coroutine and Delegation Syntax 64 Asynchronous Executors 65 Using UVLoop 66 Synchronization Primitive: Event 66 Concept 66 Example 66 A Simple Websocket 67 Common Misconception about asyncio 68 Chapter 11: Attribute Access 69 Syntax 69 Examples 69 Basic Attribute Access using the Dot Notation 69 Setters, Getters & Properties 69 Chapter 12: Audio 72 Examples 72 Audio With Pyglet 72 Working with WAV files 72 winsound 72 wave 72 Convert any soundfile with python and ffmpeg 73 Playing Windows' beeps 73 Chapter 13: Basic Curses with Python 74 Remarks 74 Examples 74 Basic Invocation Example 74 The wrapper() helper function. 74 Chapter 14: Basic Input and Output 76 Examples 76 Using input() and raw_input() 76 Using the print function 76 Function to prompt user for a number 76 Printing a string without a newline at the end 77 Read from stdin 78 Input from a File 78 Chapter 15: Binary Data 81 Syntax 81 Examples 81 Format a list of values into a byte object 81 Unpack a byte object according to a format string 81 Packing a structure 81 Chapter 16: Bitwise Operators 83 Introduction 83 Syntax 83 Examples 83 Bitwise AND 83 Bitwise OR 83 Bitwise XOR (Exclusive OR) 84 Bitwise Left Shift 84 Bitwise Right Shift 85 Bitwise NOT 85 Inplace Operations 87 Chapter 17: Boolean Operators 88 Examples 88 and 88 or 88 not 89 Short-circuit evaluation 89 `and` and `or` are not guaranteed to return a boolean 90 A simple example 90 Chapter 18: Call Python from C# 91 Introduction 91 Remarks 91 Examples 92 Python script to be called by C# application 92 C# code calling Python script 93 Chapter 19: Checking Path Existence and Permissions 95 Parameters 95 Examples 95 Perform checks using os.access 95 Chapter 20: ChemPy - python package 97 Introduction 97 Examples 97 Parsing formulae 97 Balancing stoichiometry of a chemical reaction 97 Balancing reactions 97 Chemical equilibria 98 Ionic strength 98 Chemical kinetics (system of ordinary differential equations) 98 Chapter 21: Classes 100 Introduction 100 Examples 100 Basic inheritance 100 Built-in functions that work with inheritance 101 Class and instance variables 101 Bound, unbound, and static methods 102 New-style vs. old-style classes 105 Default values for instance variables 106 Multiple Inheritance 107 Descriptors and Dotted Lookups 109 Class methods: alternate initializers 109 Class composition 111 Monkey Patching 112 Listing All Class Members 113 Introduction to classes 113 Properties 115 Singleton class 117 Chapter 22: CLI subcommands with precise help output 119 Introduction 119 Remarks 119 Examples 119 Native way (no libraries) 119 argparse (default help formatter) 120 argparse (custom help formatter) 120 Chapter 23: Code blocks, execution frames, and namespaces 123 Introduction 123 Examples 123 Code block namespaces 123 Chapter 24: Collections module 124 Introduction 124 Remarks 124 Examples 124 collections.Counter 124 collections.defaultdict 126 collections.OrderedDict 127 collections.namedtuple 128 collections.deque 129 collections.ChainMap 130 Chapter 25: Comments and Documentation 132 Syntax 132 Remarks 132 Examples 132 Single line, inline and multiline comments 132 Programmatically accessing docstrings 132 An example function 133 Another example function 133 Advantages of docstrings over regular comments 133 Write documentation using docstrings 134 Syntax conventions 134 PEP 257 134 Sphinx 135 Google Python Style Guide 136 Chapter 26: Common Pitfalls 137 Introduction 137 Examples 137 Changing the sequence you are iterating over 137 Mutable default argument 140 List multiplication and common references 141 Integer and String identity 145 Accessing int literals' attributes 146 Chaining of or operator 147 sys.argv[0] is the name of the file being executed 148 h14 148 Dictionaries are unordered 148 Global Interpreter Lock (GIL) and blocking threads 149 Variable leaking in list comprehensions and for loops 150 Multiple return 150 Pythonic JSON keys 151 Chapter 27: Commonwealth Exceptions 152 Introduction 152 Examples 152 IndentationErrors (or indentation SyntaxErrors) 152 IndentationError/SyntaxError: unexpected indent 152 Example 152 IndentationError/SyntaxError: unindent does not match any outer indentation level 153 Example 153 IndentationError: expected an indented block 153 Example 153 IndentationError: inconsistent use of tabs and spaces in indentation 153 Example 154 How to avoid this error 154 TypeErrors 154 TypeError: [definition/method] takes ? positional arguments but ? was given 154 Example 154 TypeError: unsupported operand type(s) for [operand]: '???' and '???' 155 Example 155 TypeError: '???' object is not iterable/subscriptable: 155 Example 155 TypeError: '???' object is not callable 156 Example 156 NameError: name '???' is not defined 156 It's simply not defined nowhere in the code 156 Maybe it's defined later: 156 Or it wasn't imported: 156 Python scopes and the LEGB Rule: 157 Other Errors 157 AssertError 157 KeyboardInterrupt 158 ZeroDivisionError 158 Syntax Error on good code 158 Chapter 28: Comparisons 160 Syntax 160 Parameters 160 Examples 160 Greater than or less than 160 Not equal to 161 Equal To 161 Chain Comparisons 162 Style 162 Side effects 162 Comparison by `is` vs `==` 163 Comparing Objects 164 Common Gotcha: Python does not enforce typing 165 Chapter 29: Complex math 166 Syntax 166 Examples 166 Advanced complex arithmetic 166 Basic complex arithmetic 167 Chapter 30: Conditionals 168 Introduction 168 Syntax 168 Examples 168 if, elif, and else 168 Conditional Expression (or "The Ternary Operator") 168 If statement 169 Else statement 169 Boolean Logic Expressions 170 And operator 170 Or operator 170 Lazy evaluation 170 Testing for multiple conditions 171 Truth Values 172 Using the cmp function to get the comparison result of two objects 172 Conditional Expression Evaluation Using List Comprehensions 173 Testing if an object is None and assigning it 174 Chapter 31: configparser 175 Introduction 175 Syntax 175 Remarks 175 Examples 175 Basic usage 175 Creating configuration file programatically 176 Chapter 32: Connecting Python to SQL Server 177 Examples 177 Connect to Server, Create Table, Query

  1039
Recommended publications
  • Windows Registry Troubleshooting
    Halsey · Bettany BOOKS FOR PROFESSIONALS BY PROFESSIONALS® WINDOWS TROUBLESHOOTING SERIES Windows Registry Troubleshooting Windows Registry Troubleshooting Windows Windows Registry Troubleshooting will help IT pros diagnose and repair problems with any Windows version in the workplace, including hardware and so ware incompatibilities, corrupt registries and how to implement common tweaks and hacks. Whatever version of Windows you’re using—from Vista up to Windows 8.1—the registry is at the heart of your desktop experience. So ware installs and compatibility, hardware operation, and more are managed by a complex database of codes and numbers. When something goes wrong it can seem impossible to diagnose and repair the problem, and harder still to prevent a recurrence or make the subtle changes and tweaks required to x the problem. In Windows Registry Troubleshooting we’ll take you inside the workings of the Registry, and teach you how to repair, modify and clean it to keep your PCs running smoothly. Highlights include: • How to navigate the architecture of the Windows Registry • How to troubleshoot faulty and corrupt Registry items • How to edit and work with the Registry fi les of other users on a PC • What tools and utilities can help you work with and repair the Registry • How to secure the registry on a Windows PC Windows • What Registry tweaks and hacks can make using your Windows PC a better experience Registry Troubleshooting Diagnose and repair problems with any ISBN 978-1-4842-0993-6 Windows version from Vista to Windows 8.1 52499 US $24.99 — Shelve in Mike Halsey, MVP 9781484 209936 Windows/General Andrew Bettany, MVP www.apress.com For your convenience Apress has placed some of the front matter material after the index.
    [Show full text]
  • PHP Introduction
    PHP PHP ─ Introduction PHP started out as a small open source project that evolved as more and more people found out how useful it was. Rasmus Lerdorf unleashed the first version of PHP way back in 1994. PHP is a recursive acronym for "PHP: Hypertext Preprocessor". PHP is a server side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e- commerce sites. It is integrated with a number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server. PHP is pleasingly zippy in its execution, especially when compiled as an Apache module on the Unix side. The MySQL server, once started, executes even very complex queries with huge result sets in record-setting time. PHP supports a large number of major protocols such as POP3, IMAP, and LDAP. PHP4 added support for Java and distributed object architectures (COM and CORBA), making n-tier development a possibility for the first time. PHP is forgiving: PHP language tries to be as forgiving as possible. PHP Syntax is C-Like. Common Uses of PHP PHP performs system functions, i.e. from files on a system it can create, open, read, write, and close them. The other uses of PHP are: PHP can handle forms, i.e. gather data from files, save data to a file, thru email you can send data, return data to the user. You add, delete, modify elements within your database thru PHP. Access cookies variables and set cookies. Using PHP, you can restrict users to access some pages of your website.
    [Show full text]
  • Pyyaml, Flickrapi and Tkinter
    PyYAML, flickrapi and Tkinter In a Desktop Image Display App Doug Latornell <[email protected]> VanPyZ :: 1 December 2009 2 Cool Things ● YAML as an alternative to INI for configuration files ● Access to Flickr from Python ...And 1 Useful One ● Tkinter – GUI interface toolkit in Python stdlib – Cross platform Dude, Where are the Pictures? The Big Picture But How? ● Sequential boring... ● Random annoyingly... random... LivingPics ● Display images from local or network connected storage, or Flickr ● Control the randomness and repetitiousness of the display ● Something to do while recovering from 2 broken wrists! INI Config [Timing] noshowhrs = 4.0 displaysecs = 10 [Exclusion List] exclusionlist = ./exclusion_list.txt [Image Sources] defaultsource = /Users/doug/Pictures/iPhoto Library/Originals imagesources = /Users/doug/Pictures/iPhoto Library/Originals, "" /Users/doug/Pictures/iPhoto Library/Modified/2006/Big Island of Hawaii, "" /Users/doug/Pictures/iPhoto Library/Originals/2005, "" http://www.flickr.com/photos/sada_images/, "Our flickr Stream" [Image Selection] probofjump = 0.05 rangeincr = 20 rangedecr = -10 YAML ● YAML Ain't Markup Language ● “a human friendly data serialization standard for all programming languages” YAML Config exclude_file: exclusions.yaml img_selection: prob_of_jump: 0.05 range_decr: -10 range_incr: 20 img_srcs: current_src: /Users/doug/Pictures/iPhoto Library/Originals stored_srcs: - nickname: null src: /Users/doug/Pictures/iPhoto Library/Originals - nickname: Our flickr Stream src: http://www.flickr.com/photos/sada_images/
    [Show full text]
  • Continuum & PHP
    Continuum & PHP 5.6 UPGRADING FROM PHP 5.3 WISP / LAMP NOTES WISP Platform Where do I get the update from? Windows binaries for PHP 5.6.x can be downloaded from http://windows.php.net/download/ - ​ ​ it should be the non thread safe 32-bit version that is used (x86 Non Thread Safe). What if I’m using WinCache? PHP 5.6 includes it’s own op caching, so if you use WinCache this will need to be uninstalled or commented out (using a semi-colon) in your PHP config. How can I tell if I’m using WinCache? This can be determined by visiting http://{{your-site-URL}}/jadu/maintenance/phpinfo.php in a ​ ​ browser whilst signed into the control centre, or by using apache2ctl -M from the ​ ​ command prompt. If you’re using it then you’ll see it listed there. Do I need driver updates? This depends upon your current set-up; if you don’t already have it you’ll need Microsoft ODBC Driver 11 installing and can then copy php_sqlsrv_56_nts.dll and php_pdo_sqlsrv_56_nts.dll into your PHP install’s ext folder. With these in place you’ll then need to update your php.ini to point at these in place of the PHP 5.3 equivalents. LAMP Platform In most cases this will mean you’re using CentOS or Red Hat as these are the supported Linux distributions for the Continuum platform. How do I do update PHP on CentOS/RHEL 6.x? What you’ll need to run will differ slightly depending on which distribution (CentOS vs.
    [Show full text]
  • Python Programming
    Python Programming Wikibooks.org June 22, 2012 On the 28th of April 2012 the contents of the English as well as German Wikibooks and Wikipedia projects were licensed under Creative Commons Attribution-ShareAlike 3.0 Unported license. An URI to this license is given in the list of figures on page 149. If this document is a derived work from the contents of one of these projects and the content was still licensed by the project under this license at the time of derivation this document has to be licensed under the same, a similar or a compatible license, as stated in section 4b of the license. The list of contributors is included in chapter Contributors on page 143. The licenses GPL, LGPL and GFDL are included in chapter Licenses on page 153, since this book and/or parts of it may or may not be licensed under one or more of these licenses, and thus require inclusion of these licenses. The licenses of the figures are given in the list of figures on page 149. This PDF was generated by the LATEX typesetting software. The LATEX source code is included as an attachment (source.7z.txt) in this PDF file. To extract the source from the PDF file, we recommend the use of http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/ utility or clicking the paper clip attachment symbol on the lower left of your PDF Viewer, selecting Save Attachment. After extracting it from the PDF file you have to rename it to source.7z. To uncompress the resulting archive we recommend the use of http://www.7-zip.org/.
    [Show full text]
  • Pdflib Text and Image Extraction Toolkit (TET) Manual
    ABC Text and Image Extraction Toolkit (TET) Version 5.2 Toolkit for extracting Text, Images, and other items from PDF Copyright © 2002–2019 PDFlib GmbH. All rights reserved. Protected by European and U.S. patents. PDFlib GmbH Franziska-Bilek-Weg 9, 80339 München, Germany www.pdflib.com phone +49 • 89 • 452 33 84-0 If you have questions check the PDFlib mailing list and archive at groups.yahoo.com/neo/groups/pdflib/info Licensing contact: [email protected] Support for commercial PDFlib licensees: [email protected] (please include your license number) This publication and the information herein is furnished as is, is subject to change without notice, and should not be construed as a commitment by PDFlib GmbH. PDFlib GmbH assumes no responsibility or lia- bility for any errors or inaccuracies, makes no warranty of any kind (express, implied or statutory) with re- spect to this publication, and expressly disclaims any and all warranties of merchantability, fitness for par- ticular purposes and noninfringement of third party rights. TET contains modified parts of the following third-party software: CMap resources. Copyright © 1990-2019 Adobe Zlib compression library, Copyright © 1995-2017 Jean-loup Gailly and Mark Adler TIFFlib image library, Copyright © 1988-1997 Sam Leffler, Copyright © 1991-1997 Silicon Graphics, Inc. Cryptographic software written by Eric Young, Copyright © 1995-1998 Eric Young ([email protected]) Independent JPEG Group’s JPEG software, Copyright © Copyright © 1991-2017, Thomas G. Lane, Guido Vollbeding Cryptographic software, Copyright © 1998-2002 The OpenSSL Project (www.openssl.org) Expat XML parser, Copyright © 2001-2017 Expat maintainers ICU International Components for Unicode, Copyright © 1995-2012 International Business Machines Corpo- ration and others OpenJPEG library, Copyright © 2002-2014, Université catholique de Louvain (UCL), Belgium TET contains the RSA Security, Inc.
    [Show full text]
  • Web Enablement Kit Implementation Guide
    DB2 ® IBM DB2 Content Manager OnDemand for Multiplatforms Version 8 Release 3 Web Enablement Kit Implementation Guide SC18-9231-00 DB2 ® IBM DB2 Content Manager OnDemand for Multiplatforms Version 8 Release 3 Web Enablement Kit Implementation Guide SC18-9231-00 Note Before using this information and the product it supports, read the information in “Notices” on page 187. First Edition (October 2004) This edition replaces IBM DB2 Content Manager OnDemand for Multiplatforms Version 7.1 Web Enablement Kit Implementation Guide (SC27-1000-03) This edition applies to IBM DB2 Content Manager OnDemand for Multiplatforms Version 8 Release 3 (product number 5724-J33) and to all subsequent releases and modifications until otherwise indicated in new editions. This product includes software developed by the Apache Software Foundation (http://www.apache.org/). © Copyright International Business Machines Corporation 1996, 2004. All rights reserved. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents About this publication . vii Installing on Solaris . .19 How this publication is organized. vii Your next step . .19 Who should use this publication . viii Installing on Windows servers . .20 What you should already know . viii Your next step . .20 Where to find more information . .ix Information center . .ix Chapter 5. Deploying the CGI program 21 PDF publications. .ix Before you begin . .21 Accessibility information for OnDemand . .x Copying CGI program files . .21 Support available on the Web . .x Your next step . .21 Education and training . .x How to send your comments . .x Chapter 6. Deploying the Java servlet 23 || What’s new in Version 8.3 .
    [Show full text]
  • DLI Implementation and Reference Guide
    Implementation and Reference Guide Datalogics Interface Datalogics® Datalogics DATALOGICS INTERFACE Implementation and Reference Guide This guide is part of the Adobe® PDF Library v6.1.1Plus suite; 02/15/05. Copyright 1999-2005 Datalogics Incorporated. All Rights Reserved. Use of Datalogics software is subject to the applicable license agreement. DL Interface is a trademark of Datalogics Incorporated. Other products mentioned herein as Datalogics prod- ucts are also trademarks or registered trademarks of Datalogics, Incorporated. Adobe, Adobe PDF Library, Portable Document Format (PDF), PostScript, Acrobat, Distiller, Exchange and Reader are trademarks of Adobe Systems Incorporated. HP and HP-UX are registered trademarks of Hewlett Packard Corporation. IBM, AIX, AS/400, OS/400, MVS, and OS/390 are registered trademarks of International Business Machines. Java, J2EE, J2SE, J2ME, all Java-based marks, Sun and Solaris are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Linux is a registered trademark of Linus Torvalds. Microsoft, Windows and Windows NT are trademarks or registered trademarks of Microsoft Corporation. SAS/C is a registered trademark of SAS Institute Inc. UNIX is a registered trademark of The Open Group. VeriSign® is a registered trademark of VeriSign, Inc. in the United States and/or other countries. All other trademarks and registered trademarks are the property of their respective owners. For additional information, contact: Datalogics, Incorporated 101 North Wacker
    [Show full text]
  • 공개sw 솔루션 목록(2015.12.30)
    OS/DBMS/WEB/WAS 공개SW 솔루션 목록(2015.12.30) 순번 분류 솔루션명 라이선스 기술지원 홈페이지 제품개요 1 DBMS C-JDBC LGPL community http://c-jdbc.ow2.org/ 데이터베이스 클러스터 2 DBMS DB4 오브젝트(db4o) GPL & dOCL prof/community http://www.db4o.com 객체지향 메모리 데이터베이스 엔진 GPL v2, GPL v3, 3 DBMS Drizzle community http://www.drizzle.org/ MySQL 6.0에서 파생된 RDBMS BSD 4 DBMS H2 EPL, MPL community http://www.h2database.com/ 자바기반 RDBMS HSQLDB 5 DBMS (Hyper Structured Query BSD community http://www.hsqldb.org 경량의 Java 기반 관계형 데이터베이스 Language Database) 데이터 웨어하우스, OLAP서버, BI 시스템 운용을 목적으 6 DBMS LucidDB GPL v2, LGPL v2 community http://luciddb.sourceforge.net 로 개발된 오픈소스 DBMS GPL v3, AGPL v3, 7 DBMS Neo4j community http://www.neo4j.org 그래프 데이터베이스 commercial AGPL v3, 8 DBMS VoltDB Proprietary prof/community http://voltdb.com/ 인메모리기반 RDBMS License 오픈소스 관계형 데이터베이스 관리 시스템. 9 DBMS 마리아DB(MariaDB) GPLv2, LGPL prof/community https://mariadb.org/ MySQL과 동일한 소스 코드를 기반 세계에서 가장 널리 사용되고 있는 대표적인 10 DBMS 마이에스큐엘(MySQL) GPL v2 prof/community http://www.mysql.com 관계형 데이터베이스 ※ prof : Professional Support(전문업체 기술지원) ※ community : Community Support(커뮤니티 기술지원) OS/DBMS/WEB/WAS 공개SW 솔루션 목록(2015.12.30) 순번 분류 솔루션명 라이선스 기술지원 홈페이지 제품개요 IBM에서 기증한 cloudscape 소스 기반으로 11 DBMS 아파치 더비(Apache Derby) Apache v2 community http://db.apache.org/derby/ 개발된 Java 기반의 관계형 데이터베이스 Berkeley 오라클 버클리 DB Database License http://www.oracle.com/kr/products/database/ 슬리피캣을 인수한 오라클에서 제공하는 12 DBMS prof/community (Oracle Berkeley DB) or berkeley-db/index.html 고성능 임베디드 데이터베이스 Sleepycat License GPL or Postgresql 데이터베이스의 기반으로 상용화된 13 DBMS 잉그레스(Ingres) prof/community
    [Show full text]
  • Pyglet Documentation Release 1.2Alpha1
    pyglet Documentation Release 1.2alpha1 Alex Holkner October 13, 2013 CONTENTS 1 Programming Guide: 3 1.1 pyglet Programming Guide.......................................3 2 API Reference: 87 2.1 API Reference.............................................. 87 3 Testing Framework: 117 4 Related Documentation: 119 Python Module Index 121 i ii pyglet Documentation, Release 1.2alpha1 Pyglet is a pure python cross-platform application framework intended for game development. It supports windowing, user interface event handling, OpenGL graphics, loading images and videos and playing sounds and music. It works on Windows, OS X and Linux. CONTENTS 1 pyglet Documentation, Release 1.2alpha1 2 CONTENTS CHAPTER ONE PROGRAMMING GUIDE: 1.1 pyglet Programming Guide breadcrumb Programming Guide The pyglet Programming Guide provides in-depth documentation for writing applications that use pyglet. Many topics described here reference the pyglet API reference, provided separately. If this is your first time reading about pyglet, we suggest you start at Writing a pyglet application. 1.1.1 Installation pyglet does not need to be installed. Because it uses no external libraries or compiled binaries, you can run it in-place. You can distribute the pyglet source code or runtime eggs alongside your application code (see Distribution). You might want to experiment with pyglet and run the example programs before you install it on your development machine. To do this, add either the extracted pyglet source archive directory or the compressed runtime egg to your PYTHONPATH. On Windows you can specify this from a command line: set PYTHONPATH c:\path\to\pyglet-1.1\;%PYTHONPATH% On Mac OS X, Linux or on Windows under cygwin using bash: set PYTHONPATH /path/to/pyglet-1.1/:$PYTHONPATH export PYTHONPATH or, using tcsh or a variant: setenv PYTHONPATH /path/to/pyglet-1.1/:$PYTHONPATH If you have downloaded a runtime egg instead of the source archive, you would specify the filename of the egg in place of pyglet-1.1/.
    [Show full text]
  • Deviceside Software Update Strategies for Automotive Grade Linux
    Device­side Software Update Strategies for Automotive Grade Linux Konsulko Group, sponsored by ATS Advanced Telematic Systems GmbH Overview This whitepaper explores the area of software update strategies for devices running Automotive Grade Linux. The starting point is understanding several key use cases for updating software in an AGL1 system. Several open source device­side software update mechanisms are compared with a focus on their ability to meet the stated use cases. Finally, recommendations are made for an approach that can be implemented for inclusion in AGL. Use Cases and Requirements The topic of software update on any computing device is very broad and can only be examined properly by narrowing the scope of the system, operating conditions, and the policies established for executing a software update. The following sections describe the use cases considered when evaluating the various mechanisms that could be employed in an AGL software update strategy. System Description AGL systems include both IVI2 and ADAS3 devices that run Linux on at least one processor in the system. The complete IVI or ADAS system is not necessarily limited to a single processing node, but is normally part of a larger network that includes a number of ECU4 nodes throughout the automobile. Due to this distributed architecture it is often necessary to update software on 1 Automotive Grade Linux (https://www.automotivelinux.org/agl­specification) ​ 2 In­Vehicle Infotainment 3 Advanced Driver Assistance System 4 Electronic Control Unit Copyright 2016 Konsulko Group and ATS Advanced Telematic Systems GmbH CC BY­SA 3.0 US (https://creativecommons.org/licenses/by­sa/3.0/us/) ​ ​ the ECUs as well as the node running AGL.
    [Show full text]
  • Psychology Software for Python Release 3.0.2
    PsychoPy - Psychology software for Python Release 3.0.2 Jonathan Peirce Jan 29, 2019 Contents 1 About PsychoPy 1 2 General issues 3 3 Installation 29 4 Manual install 31 5 Getting Started 35 6 Builder 43 7 Coder 75 8 Running studies online 95 9 Reference Manual (API) 103 10 Troubleshooting 325 11 Recipes (“How-to”s) 329 12 Frequently Asked Questions (FAQs) 341 13 Resources (e.g. for teaching) 343 14 For Developers 345 15 PsychoPy Experiment file format (.psyexp) 359 Python Module Index 363 i ii CHAPTER 1 About PsychoPy 1.1 Citing PsychoPy If you use this software, please cite one of the publications that describe it. • Peirce, J. W., & MacAskill, M. R. (2018). Building Experiments in PsychoPy. London: Sage. • Peirce J. W. (2009). Generating stimuli for neuroscience using PsychoPy. Frontiers in Neuroinformatics, 2 (10), 1-8. doi:10.3389/neuro.11.010.2008 • Peirce, J. W. (2007). PsychoPy - Psychophysics software in Python. Journal of Neuroscience Methods, 162 (1-2):8-13 doi:10.1016/j.jneumeth.2006.11.017 Citing these papers gives the reviewer/reader of your study information about how the system works and it attributes some credit for its original creation. Academic assessment (whether for promotion or even getting appointed to a job in the first place) prioritises publications over making useful tools for others. Citations provide a way for the developers to justify their continued involvement in the development of the package. 1 PsychoPy - Psychology software for Python, Release 3.0.2 2 Chapter 1. About PsychoPy CHAPTER 2 General issues These are issues that users should be aware of, whether they are using Builder or Coder views.
    [Show full text]