Advanced Guide to Python 3 Programming
- 2019
- Book
- Author
- Dr. John Hunt
- Book Series
- Undergraduate Topics in Computer Science
- Publisher
- Springer International Publishing
About this book
Advanced Guide to Python 3 Programming delves deeply into a host of subjects that you need to understand if you are to develop sophisticated real-world programs. Each topic is preceded by an introduction followed by more advanced topics, along with numerous examples, that take you to an advanced level.
There are nine different sections within the book covering Computer Graphics
(including GUIs), Games, Testing, File Input and Output, Databases Access, Logging, Concurrency and Parallelism, Reactive programming, and Networking. Each section is self-contained and can either be read on its own or as part of the book as a whole.
This book is aimed at the those who have learnt the basics of the Python 3 language
but want to delve deeper into Python’s eco system of additional libraries and modules,
to explore concurrency and parallelism, to create impressive looking graphical interfaces, to work with databases and files and to provide professional logging facilities.
Table of Contents
-
Frontmatter
-
1. Introduction
John HuntAbstractI have heard many people over the years say that Python is an easy language to lean and that Python is also a simple language. To some extent both of these statements are true; but only to some extent. However, once you have learned the core elements of the language such as how classes and inheritance work, how functions work, what are protocols and Abstract Base Classes etc. Where do you go next? The aim of this book is to delve into those next steps. -
Computer Graphics
-
Frontmatter
-
2. Introduction to Computer Graphics
John HuntAbstractComputer Graphics are everywhere; they are on your TV, in cinema adverts, the core of many films, on your tablet or mobile phone and certainly on your PC or Mac as well as on the dashboard of your car, on your smart watch and in childrens electronic toys. This chapter introduces this topic. -
3. Python Turtle Graphics
John HuntAbstractPython is very well supported in terms of graphics libraries. One of the most widely used graphics libraries is the Turtle Graphics library introduced in this chapter. This is partly because it is straight forward to use and partly because it is provided by default with the Python environment (and thus you do not need to install any additional libraries to use it). -
4. Creating Computer Art
John HuntAbstractComputer Art is defined as any art that uses a computer. However, in the context of this book we mean it to be art that is generated by a computer or more specifically a computer program. The following example, illustrates how in a very few lines of Python code, using the Turtle graphics library, you can create images that might be considered to be computer art. -
5. Introduction to Matplotlib
John HuntAbstractMatplotlib is a Python graphing and plotting library that can generate a variety of different types of graph or chart in a variety of different formats. It can be used to generate line charts, scatter graphs, heat maps, bar charts, pie charts and 3D plots. It can even support animations and interactive displays. In this chapter we will introduce the Matplotlib library, its architecture, the components that comprise a chart and the pyplot API. -
6. Graphing with Matplotlib pyplot
John HuntAbstractIn this chapter we will explore the Matplotlib pyplot API. This is the most common way in which developers generate different types of graphs or plots using Matplotlib. -
7. Graphical User Interfaces
John HuntAbstractA Graphical User Interface can capture the essence of an idea or a situation, often avoiding the need for a long passage of text. Such interfaces can save a user from the need to learn complex commands. They are less likely to intimidate computer users and can provide a large amount of information quickly in a form which can be easily assimilated by the user. This chapter we will first introduce what we mean by a GUI and by WIMP based UIs in particular. We will then consider the range of libraries available for Python before selecting wxPython. -
8. The wxPython GUI Library
John HuntAbstractThe wxPython library is a cross platform GUI library (or toolkit) for Python. It allows programmers to develop highly graphical user interfaces for their programs using common concepts such as menu bars, menus, buttons, fields, panels and frames. This chapter provides an overview of the wxPython GUI library. -
9. Events in wxPython User Interfaces
John HuntAbstractEvents are an integral part of any GUI; they represent user interactions with the interface such as clicking on a button, entering text into a field, selecting a menu option etc. This chapter introduces event handling in wxPython. -
10. PyDraw wxPython Example Application
John HuntAbstractThis chapter builds on the GUI library presented in the last two chapters to illustrate how a larger application can be built. It presents a case study of a drawing tool akin to a tool such as Visio etc.
-
-
Computer Games
-
Frontmatter
-
11. Introduction to Games Programming
John HuntAbstractGames programming is performed by developers/coders who implement the logic that drives a game. This chapter introduces Games programming. -
12. Building Games with pygame
John HuntAbstractpygame is a cross-platform, free and Open Source Python library designed to make building multimedia applications such as games easy. This chapter introduces pygame, the key concepts; the key modules, classes and functions and a very simple first pygame application. -
13. StarshipMeteors pygame
John HuntAbstractIn this chapter we will create a game in which you pilot a starship through a field of meteors. The longer you play the game the larger the number of meteors you will encounter. We will implement several classes to represent the entities within the game.
-
-
Testing
-
Frontmatter
-
14. Introduction to Testing
John HuntAbstractThis chapter considers the different types of tests that you might want to perform with the systems you develop in Python. It also introduces Test Driven Development -
15. PyTest Testing Framework
John HuntAbstractThere are several testing frameworks available for Python, although only one, unittest comes as part of the typical Python installation. Typical libraries include unittest (which is available within the Python distribution by default) and PyTest. This chapter introduces the PyTest testing framework. -
16. Mocking for Testing
John HuntAbstractTesting software systems is not an easy thing to do; the functions, objects, methods etc. That are involved in any program can be complex things in their own right. In many cases they depend on and interact with other functions, methods and objects; very few functions and methods operate in isolation. Thus the success of failure of a function or method or the overall state of an object is dependent on other program elements.
-
- Title
- Advanced Guide to Python 3 Programming
- Author
-
Dr. John Hunt
- Copyright Year
- 2019
- Publisher
- Springer International Publishing
- Electronic ISBN
- 978-3-030-25943-3
- Print ISBN
- 978-3-030-25942-6
- DOI
- https://doi.org/10.1007/978-3-030-25943-3
Accessibility information for this book is coming soon. We're working to make it available as quickly as possible. Thank you for your patience.