This document provides an introduction to GUI programming using Tkinter and turtle graphics in Python. It discusses how turtle programs use Tkinter to create windows and display graphics. Tkinter is a Python package for building graphical user interfaces based on the Tk widget toolkit. Several examples are provided on how to use turtle graphics to draw shapes, add color and interactivity using keyboard and mouse inputs. GUI programming with Tkinter allows creating more complex programs and games beyond what can be done with turtle graphics alone.
This book is intended for education and fun. Python is an amazing, text-based coding language, perfectly suited for children older than the age of 10. The Standard Python library has a module called Turtle which is a popular way to introduce programming to kids. This library enables children to create pictures and shapes by providing them with a virtual canvas. With the Python Turtle library, you can create nice animation projects using images that are taken from the internet, scaled-down stored as a gif-files download to the projects. The book includes 19 basic lessons with examples that introduce to the Python codes through Turtle library which is convenient to the school students of 10+years old. The book has also a lot of projects that show how to make different animations with Turtle graphics: games, applications to math, physics, and science.
Intro to Python for High School Students.
Unit #2: classes, as well as docstrings, lambda, map, filter, logging, testing, debugging
Does not include GUI content
Scientific Computing with Python Webinar March 19: 3D Visualization with MayaviEnthought, Inc.
In this webinar, Didrik Pinte provides an introduction to MayaVi, the 3D interactive visualization library for the open source Enthought Tool Suite. These tools provide scientists and engineers a sophisticated Python development framework for analysis and visualization.
The Ring programming language version 1.4 book - Part 14 of 30Mahmoud Samir Fayed
This document chapter describes a game engine project for 2D games created using Ring. It discusses the different layers of the project including the games layer, game engine classes layer, interface to graphics libraries layer, and graphics library bindings layer. It provides details on classes for sprites, text, animation, sounds, and maps. It also gives examples of how to use the game engine to create a game window, draw text, move text, and play sounds.
The Ring programming language version 1.9 book - Part 58 of 210Mahmoud Samir Fayed
This document discusses using different programming paradigms together in a game engine project. It describes layers for games, the game engine classes, and the interface to graphics libraries. The layers are: games (declarative), game engine classes (object-oriented), interface to graphics library (procedural), and graphics library bindings. The document provides details on classes for the game engine like Game, GameObject, Sprite, Text, Animate, Sound, and Map. It also gives examples of how to use the engine by creating a game window and drawing/moving text.
Basic concept of Deep Learning with explaining its structure and backpropagation method and understanding autograd in PyTorch. (+ Data parallism in PyTorch)
This document provides a summary of a 30-minute presentation on feature selection in Python. The presentation covered several common feature selection techniques in Python like LASSO, random forests, and PCA. Code examples were provided to demonstrate how to perform feature selection on the Iris dataset using these techniques in scikit-learn. Dimensionality reduction with PCA and word embeddings with Gensim were also briefly discussed. The presentation aimed to provide practical code examples to do feature selection without explanations of underlying mathematics or theory.
This book is intended for education and fun. Python is an amazing, text-based coding language, perfectly suited for children older than the age of 10. The Standard Python library has a module called Turtle which is a popular way to introduce programming to kids. This library enables children to create pictures and shapes by providing them with a virtual canvas. With the Python Turtle library, you can create nice animation projects using images that are taken from the internet, scaled-down stored as a gif-files download to the projects. The book includes 19 basic lessons with examples that introduce to the Python codes through Turtle library which is convenient to the school students of 10+years old. The book has also a lot of projects that show how to make different animations with Turtle graphics: games, applications to math, physics, and science.
Intro to Python for High School Students.
Unit #2: classes, as well as docstrings, lambda, map, filter, logging, testing, debugging
Does not include GUI content
Scientific Computing with Python Webinar March 19: 3D Visualization with MayaviEnthought, Inc.
In this webinar, Didrik Pinte provides an introduction to MayaVi, the 3D interactive visualization library for the open source Enthought Tool Suite. These tools provide scientists and engineers a sophisticated Python development framework for analysis and visualization.
The Ring programming language version 1.4 book - Part 14 of 30Mahmoud Samir Fayed
This document chapter describes a game engine project for 2D games created using Ring. It discusses the different layers of the project including the games layer, game engine classes layer, interface to graphics libraries layer, and graphics library bindings layer. It provides details on classes for sprites, text, animation, sounds, and maps. It also gives examples of how to use the game engine to create a game window, draw text, move text, and play sounds.
The Ring programming language version 1.9 book - Part 58 of 210Mahmoud Samir Fayed
This document discusses using different programming paradigms together in a game engine project. It describes layers for games, the game engine classes, and the interface to graphics libraries. The layers are: games (declarative), game engine classes (object-oriented), interface to graphics library (procedural), and graphics library bindings. The document provides details on classes for the game engine like Game, GameObject, Sprite, Text, Animate, Sound, and Map. It also gives examples of how to use the engine by creating a game window and drawing/moving text.
Basic concept of Deep Learning with explaining its structure and backpropagation method and understanding autograd in PyTorch. (+ Data parallism in PyTorch)
This document provides a summary of a 30-minute presentation on feature selection in Python. The presentation covered several common feature selection techniques in Python like LASSO, random forests, and PCA. Code examples were provided to demonstrate how to perform feature selection on the Iris dataset using these techniques in scikit-learn. Dimensionality reduction with PCA and word embeddings with Gensim were also briefly discussed. The presentation aimed to provide practical code examples to do feature selection without explanations of underlying mathematics or theory.
The document contains code snippets demonstrating the use of TensorFlow for building and training neural networks. It shows how to:
1. Define operations like convolutions, max pooling, fully connected layers using common TensorFlow functions like tf.nn.conv2d and tf.nn.max_pool.
2. Create and initialize variables using tf.Variable and initialize them using tf.global_variables_initializer.
3. Construct a multi-layer perceptron model for MNIST classification with convolutional and fully connected layers.
4. Train the model using tf.train.AdamOptimizer by running optimization steps and calculating loss over batches of data.
5. Evaluate the trained model on test data to calculate accuracy.
An introduction to Google's AI Engine, look deeper into Artificial Networks and Machine Learning. Appreciate how our simplest neural network be codified and be used to data analytics.
This document discusses computer vision applications using TensorFlow for deep learning. It introduces computer vision and convolutional neural networks. It then demonstrates how to build and train a CNN for MNIST handwritten digit recognition using TensorFlow. Finally, it shows how to load and run the pre-trained Google Inception model for image classification.
Abstract: This PDSG workshop introduces basic concepts on TensorFlow. The course covers fundamentals. Concepts covered are Vectors/Matrices/Vectors, Design&Run, Constants, Operations, Placeholders, Bindings, Operators, Loss Function and Training.
Level: Fundamental
Requirements: Some basic programming knowledge is preferred. No prior statistics background is required.
This document discusses seven ways to use Python's turtle module. It begins with an introduction to the history and configuration of the turtle module. It then outlines seven ways to use the module: 1) classical turtle graphics for beginners using a procedural style, 2) using Cartesian geometry commands, 3) representing turtles as objects, and 4) using turtles as geometrical objects. Examples are provided for each approach, such as drawing shapes, simulating orbits, and representing the Towers of Hanoi game. The document emphasizes the turtle module's versatility through different programming styles and approaches to graphics.
This document provides an overview of TensorFlow presented by Ashish Agarwal and Ashish Bansal. The key points covered include:
- TensorFlow is an open-source machine learning framework for research and production. It allows models to be deployed across different platforms.
- TensorFlow models are represented as dataflow graphs where nodes are operations and edges are tensors flowing between operations. Placeholders, variables, and sessions are introduced.
- Examples demonstrate basic linear regression and logistic regression models built with TensorFlow. Layers API and common neural network components like convolutions and RNNs are also covered.
- Advanced models like AlexNet, Inception, ResNet, and neural machine translation with attention are briefly overviewed.
This document provides an overview of coding in style with Scala. It discusses embracing expressions over statements, operator notation, using language features to simplify code, favoring higher-order functions, manipulating data with collections, working with asynchronous code and futures, macro programming to transform ASTs, and new features coming in Scala 2.11 like potential modularization and performance improvements. The document encourages idiomatic Scala techniques like favoring expressions, embracing operators, letting the language do work, aiming higher with higher-order functions, and embracing new language features.
For the full video of this presentation, please visit:
https://www.embedded-vision.com/platinum-members/embedded-vision-alliance/embedded-vision-training/videos/pages/dec-2019-alliance-vitf-facebook
For more information about embedded vision, please visit:
http://www.embedded-vision.com
Joseph Spisak, Product Manager at Facebook, delivers the presentation "PyTorch Deep Learning Framework: Status and Directions" at the Embedded Vision Alliance's December 2019 Vision Industry and Technology Forum. Spisak gives an update on the Torch deep learning framework and where it’s heading.
Pybelsberg is a project allowing constraint-based programming in Python using the Z3 theorem prover [1].
It is available on Github [2] and is licensed under the BSD 3-Clause License.
By Robert Lehmann, Christoph Matthies, Conrad Calmez, Thomas Hille.
See also Babelsberg/R [4] and Babelsberg/JS [5].
[1] https://github.com/Z3Prover/z3
[2] https://github.com/babelsberg/pybelsberg
[3] http://opensource.org/licenses/BSD-3-Clause
[4] https://github.com/timfel/babelsberg-r
[5] https://github.com/timfel/babelsberg-js
Deep learning continues to push the state of the art in domains such as computer vision, natural language understanding and recommendation engines. One of the key reasons for this progress is the availability of highly flexible and developer friendly deep learning frameworks. During this workshop, members of the Amazon Machine Learning team will provide a short background on Deep Learning focusing on relevant application domains and an introduction to using the powerful and scalable Deep Learning framework, MXNet. At the end of this tutorial you’ll gain hands on experience targeting a variety of applications including computer vision and recommendation engines as well as exposure to how to use preconfigured Deep Learning AMIs and CloudFormation Templates to help speed your development.
This document provides an overview of advanced Python concepts including: inheritance and the MRO; mixins; variable scope; iterators and generators; list comprehensions; itertools; coroutines; operator overloading; __getattr__ and __dict__; decorators; descriptors; properties; functions vs methods; type and metaprogramming; and using __metaclass__. It includes code examples to demonstrate these concepts.
Gentlest Introduction to Tensorflow - Part 2Khor SoonHin
Video: https://youtu.be/Trc52FvMLEg
Article: https://medium.com/@khor/gentlest-introduction-to-tensorflow-part-2-ed2a0a7a624f
Code: https://github.com/nethsix/gentle_tensorflow
Continuing from Part 1 where we used Tensorflow to perform linear regression for a model with single feature, here we:
* Use Tensorboard to visualize linear regression variables and the Tensorflow network graph
* Perform stochastic/mini-batch/batch gradient descent
A fast-paced introduction to Deep Learning concepts, such as activation functions, cost functions, back propagation, and then a quick dive into CNNs, followed by a Keras code sample for defining a CNN. Basic knowledge of vectors, matrices, and derivatives is helpful in order to derive the maximum benefit from this session. Then we'll see a short introduction to TensorFlow 1.x and some insights into TF 2 that will be released some time this year.
PyTorch is one of the most widely used deep learning library in python community. In this talk I will cover the basic to advanced guide to implement deep learning model using PyTorch. My goal is to introduce PyTorch and show how to use it for deep learning project.
TensorFlow is an open source neural network library for Python and C++. It defines data flows as graphs with nodes representing operations and edges representing multidimensional data arrays called tensors. It supports supervised learning algorithms like gradient descent to minimize cost functions. TensorFlow automatically computes gradients so the user only needs to define the network structure, cost function, and optimization algorithm. An example shows training various neural network models on the MNIST handwritten digit dataset, achieving up to 99.2% accuracy. TensorFlow can implement other models like recurrent neural networks and is a simple yet powerful framework for neural networks.
This session for beginners introduces tf.data APIs for creating data pipelines by combining various "lazy operators" in tf.data, such as filter(), map(), batch(), zip(), flatmap(), take(), and so forth.
Familiarity with method chaining and TF2 is helpful (but not required). If you are comfortable with FRP, the code samples in this session will be very familiar to you.
Rajat Monga at AI Frontiers: Deep Learning with TensorFlowAI Frontiers
In this talk at AI Frontiers Conference, Rajat Monga shares about TensorFlow that has enabled cutting-edge machine learning research at the top AI labs in the world. At the same time it has made the technology accessible to a large audience leading to some amazing uses. TensorFlow is used for classification, recommendation, text parsing, sentiment analysis and more. This talk goes over the design that makes it fast, flexible, and easy to use, and describe how we continue to make it better.
A fast-paced introduction to Deep Learning concepts, such as activation functions, cost functions, back propagation, and then a quick dive into CNNs. Basic knowledge of vectors, matrices, and derivatives is helpful in order to derive the maximum benefit from this session. Then we'll see a short introduction to TensorFlow and TensorBoard.
TensorFlow is a wonderful tool for rapidly implementing neural networks. In this presentation, we will learn the basics of TensorFlow and show how neural networks can be built with just a few lines of code. We will highlight some of the confusing bits of TensorFlow as a way of developing the intuition necessary to avoid common pitfalls when developing your own models. Additionally, we will discuss how to roll our own Recurrent Neural Networks. While many tutorials focus on using built in modules, this presentation will focus on writing neural networks from scratch enabling us to build flexible models when Tensorflow’s high level components can’t quite fit our needs.
About Nathan Lintz:
Nathan Lintz is a research scientist at indico Data Solutions where he is responsible for developing machine learning systems in the domains of language detection, text summarization, and emotion recognition. Outside of work, Nathan is currently writting a book on TensorFlow as an extension to his tutorial repository https://github.com/nlintz/TensorFlow-Tutorials
Link to video https://www.youtube.com/watch?v=op1QJbC2g0E&feature=youtu.be
Computer Graphics in Java and Scala - Part 1bPhilip Schwarz
First see the Scala program from Part 1 translated into Java.
Then see the Scala program modified to produce a more intricate drawing.
Java Code: https://github.com/philipschwarz/computer-graphics-50-triangles-java
Scala Code: https://github.com/philipschwarz/computer-graphics-chessboard-with-a-great-many-squares-scala
This document discusses animations in SwiftUI. It provides an overview of basic animation properties like position, size, angle, shape, and color that can be animated. It also covers transformation animations using translation, scaling, rotation, and opacity. Different timing functions for animations like linear, easeIn, easeOut, easeInOut, and spring are demonstrated. The key concepts of Animatable and VectorArithmetic protocols that enable property animation are explained. Examples are provided to illustrate animating a star shape by modifying its edges property over time. Custom animatable modifiers like PercentageModifier are also demonstrated to create progress indicators. The document concludes by emphasizing the effective way to implement animation in SwiftUI.
The document contains code snippets demonstrating the use of TensorFlow for building and training neural networks. It shows how to:
1. Define operations like convolutions, max pooling, fully connected layers using common TensorFlow functions like tf.nn.conv2d and tf.nn.max_pool.
2. Create and initialize variables using tf.Variable and initialize them using tf.global_variables_initializer.
3. Construct a multi-layer perceptron model for MNIST classification with convolutional and fully connected layers.
4. Train the model using tf.train.AdamOptimizer by running optimization steps and calculating loss over batches of data.
5. Evaluate the trained model on test data to calculate accuracy.
An introduction to Google's AI Engine, look deeper into Artificial Networks and Machine Learning. Appreciate how our simplest neural network be codified and be used to data analytics.
This document discusses computer vision applications using TensorFlow for deep learning. It introduces computer vision and convolutional neural networks. It then demonstrates how to build and train a CNN for MNIST handwritten digit recognition using TensorFlow. Finally, it shows how to load and run the pre-trained Google Inception model for image classification.
Abstract: This PDSG workshop introduces basic concepts on TensorFlow. The course covers fundamentals. Concepts covered are Vectors/Matrices/Vectors, Design&Run, Constants, Operations, Placeholders, Bindings, Operators, Loss Function and Training.
Level: Fundamental
Requirements: Some basic programming knowledge is preferred. No prior statistics background is required.
This document discusses seven ways to use Python's turtle module. It begins with an introduction to the history and configuration of the turtle module. It then outlines seven ways to use the module: 1) classical turtle graphics for beginners using a procedural style, 2) using Cartesian geometry commands, 3) representing turtles as objects, and 4) using turtles as geometrical objects. Examples are provided for each approach, such as drawing shapes, simulating orbits, and representing the Towers of Hanoi game. The document emphasizes the turtle module's versatility through different programming styles and approaches to graphics.
This document provides an overview of TensorFlow presented by Ashish Agarwal and Ashish Bansal. The key points covered include:
- TensorFlow is an open-source machine learning framework for research and production. It allows models to be deployed across different platforms.
- TensorFlow models are represented as dataflow graphs where nodes are operations and edges are tensors flowing between operations. Placeholders, variables, and sessions are introduced.
- Examples demonstrate basic linear regression and logistic regression models built with TensorFlow. Layers API and common neural network components like convolutions and RNNs are also covered.
- Advanced models like AlexNet, Inception, ResNet, and neural machine translation with attention are briefly overviewed.
This document provides an overview of coding in style with Scala. It discusses embracing expressions over statements, operator notation, using language features to simplify code, favoring higher-order functions, manipulating data with collections, working with asynchronous code and futures, macro programming to transform ASTs, and new features coming in Scala 2.11 like potential modularization and performance improvements. The document encourages idiomatic Scala techniques like favoring expressions, embracing operators, letting the language do work, aiming higher with higher-order functions, and embracing new language features.
For the full video of this presentation, please visit:
https://www.embedded-vision.com/platinum-members/embedded-vision-alliance/embedded-vision-training/videos/pages/dec-2019-alliance-vitf-facebook
For more information about embedded vision, please visit:
http://www.embedded-vision.com
Joseph Spisak, Product Manager at Facebook, delivers the presentation "PyTorch Deep Learning Framework: Status and Directions" at the Embedded Vision Alliance's December 2019 Vision Industry and Technology Forum. Spisak gives an update on the Torch deep learning framework and where it’s heading.
Pybelsberg is a project allowing constraint-based programming in Python using the Z3 theorem prover [1].
It is available on Github [2] and is licensed under the BSD 3-Clause License.
By Robert Lehmann, Christoph Matthies, Conrad Calmez, Thomas Hille.
See also Babelsberg/R [4] and Babelsberg/JS [5].
[1] https://github.com/Z3Prover/z3
[2] https://github.com/babelsberg/pybelsberg
[3] http://opensource.org/licenses/BSD-3-Clause
[4] https://github.com/timfel/babelsberg-r
[5] https://github.com/timfel/babelsberg-js
Deep learning continues to push the state of the art in domains such as computer vision, natural language understanding and recommendation engines. One of the key reasons for this progress is the availability of highly flexible and developer friendly deep learning frameworks. During this workshop, members of the Amazon Machine Learning team will provide a short background on Deep Learning focusing on relevant application domains and an introduction to using the powerful and scalable Deep Learning framework, MXNet. At the end of this tutorial you’ll gain hands on experience targeting a variety of applications including computer vision and recommendation engines as well as exposure to how to use preconfigured Deep Learning AMIs and CloudFormation Templates to help speed your development.
This document provides an overview of advanced Python concepts including: inheritance and the MRO; mixins; variable scope; iterators and generators; list comprehensions; itertools; coroutines; operator overloading; __getattr__ and __dict__; decorators; descriptors; properties; functions vs methods; type and metaprogramming; and using __metaclass__. It includes code examples to demonstrate these concepts.
Gentlest Introduction to Tensorflow - Part 2Khor SoonHin
Video: https://youtu.be/Trc52FvMLEg
Article: https://medium.com/@khor/gentlest-introduction-to-tensorflow-part-2-ed2a0a7a624f
Code: https://github.com/nethsix/gentle_tensorflow
Continuing from Part 1 where we used Tensorflow to perform linear regression for a model with single feature, here we:
* Use Tensorboard to visualize linear regression variables and the Tensorflow network graph
* Perform stochastic/mini-batch/batch gradient descent
A fast-paced introduction to Deep Learning concepts, such as activation functions, cost functions, back propagation, and then a quick dive into CNNs, followed by a Keras code sample for defining a CNN. Basic knowledge of vectors, matrices, and derivatives is helpful in order to derive the maximum benefit from this session. Then we'll see a short introduction to TensorFlow 1.x and some insights into TF 2 that will be released some time this year.
PyTorch is one of the most widely used deep learning library in python community. In this talk I will cover the basic to advanced guide to implement deep learning model using PyTorch. My goal is to introduce PyTorch and show how to use it for deep learning project.
TensorFlow is an open source neural network library for Python and C++. It defines data flows as graphs with nodes representing operations and edges representing multidimensional data arrays called tensors. It supports supervised learning algorithms like gradient descent to minimize cost functions. TensorFlow automatically computes gradients so the user only needs to define the network structure, cost function, and optimization algorithm. An example shows training various neural network models on the MNIST handwritten digit dataset, achieving up to 99.2% accuracy. TensorFlow can implement other models like recurrent neural networks and is a simple yet powerful framework for neural networks.
This session for beginners introduces tf.data APIs for creating data pipelines by combining various "lazy operators" in tf.data, such as filter(), map(), batch(), zip(), flatmap(), take(), and so forth.
Familiarity with method chaining and TF2 is helpful (but not required). If you are comfortable with FRP, the code samples in this session will be very familiar to you.
Rajat Monga at AI Frontiers: Deep Learning with TensorFlowAI Frontiers
In this talk at AI Frontiers Conference, Rajat Monga shares about TensorFlow that has enabled cutting-edge machine learning research at the top AI labs in the world. At the same time it has made the technology accessible to a large audience leading to some amazing uses. TensorFlow is used for classification, recommendation, text parsing, sentiment analysis and more. This talk goes over the design that makes it fast, flexible, and easy to use, and describe how we continue to make it better.
A fast-paced introduction to Deep Learning concepts, such as activation functions, cost functions, back propagation, and then a quick dive into CNNs. Basic knowledge of vectors, matrices, and derivatives is helpful in order to derive the maximum benefit from this session. Then we'll see a short introduction to TensorFlow and TensorBoard.
TensorFlow is a wonderful tool for rapidly implementing neural networks. In this presentation, we will learn the basics of TensorFlow and show how neural networks can be built with just a few lines of code. We will highlight some of the confusing bits of TensorFlow as a way of developing the intuition necessary to avoid common pitfalls when developing your own models. Additionally, we will discuss how to roll our own Recurrent Neural Networks. While many tutorials focus on using built in modules, this presentation will focus on writing neural networks from scratch enabling us to build flexible models when Tensorflow’s high level components can’t quite fit our needs.
About Nathan Lintz:
Nathan Lintz is a research scientist at indico Data Solutions where he is responsible for developing machine learning systems in the domains of language detection, text summarization, and emotion recognition. Outside of work, Nathan is currently writting a book on TensorFlow as an extension to his tutorial repository https://github.com/nlintz/TensorFlow-Tutorials
Link to video https://www.youtube.com/watch?v=op1QJbC2g0E&feature=youtu.be
Computer Graphics in Java and Scala - Part 1bPhilip Schwarz
First see the Scala program from Part 1 translated into Java.
Then see the Scala program modified to produce a more intricate drawing.
Java Code: https://github.com/philipschwarz/computer-graphics-50-triangles-java
Scala Code: https://github.com/philipschwarz/computer-graphics-chessboard-with-a-great-many-squares-scala
This document discusses animations in SwiftUI. It provides an overview of basic animation properties like position, size, angle, shape, and color that can be animated. It also covers transformation animations using translation, scaling, rotation, and opacity. Different timing functions for animations like linear, easeIn, easeOut, easeInOut, and spring are demonstrated. The key concepts of Animatable and VectorArithmetic protocols that enable property animation are explained. Examples are provided to illustrate animating a star shape by modifying its edges property over time. Custom animatable modifiers like PercentageModifier are also demonstrated to create progress indicators. The document concludes by emphasizing the effective way to implement animation in SwiftUI.
Writing a Space Shooter with HTML5 CanvasSteve Purkis
This talk reviews a Space Shooter game that I wrote to learn about HTML5 canvas. It covers:
* Basics of canvas 2D
* Overview of how the game is put together
* Some performance tips
First presented @ Ottawa JavaScript in September 2012.
Swift is proposed as a next-generation platform for TensorFlow that could provide benefits over Python like improved performance, type safety, and enabling automatic differentiation at compile time. However, Python currently dominates the machine learning ecosystem. Swift and Python are intended to have a complementary relationship, with each suited to different use cases. Examples show comparable MNIST implementations in both Swift and Python for TensorFlow.
This fast-paced session starts with an introduction to neural networks and linear regression models, along with a quick view of TensorFlow, followed by some Scala APIs for TensorFlow. You'll also see a simple dockerized image of Scala and TensorFlow code and how to execute the code in that image from the command line. No prior knowledge of NNs, Keras, or TensorFlow is required (but you must be comfortable with Scala).
COMPAPPABCA49085rFunrAP__Practical Number 9 & 10.docxTashiBhutia12
This program performs 3D transformations (translation, rotation, scaling, and reflection) on a cube. It uses matrix transformations to manipulate the coordinates of the cube's vertices. The user selects the type of transformation and provides any necessary parameters. The cube is drawn before and after the transformation to visualize the effect. Key steps include setting up transformation matrices, applying them by pre-multiplying to a global matrix, transforming the vertex coordinates, and redrawing the cube.
Introduction to Neural Networks and Deep Learning from ScratchAhmed BESBES
If you're willing to understand how neural networks work behind the scene and debug the back-propagation algorithm step by step by yourself, this presentation should be a good starting point.
We'll cover elements on:
- the popularity of neural networks and their applications
- the artificial neuron and the analogy with the biological one
- the perceptron
- the architecture of multi-layer perceptrons
- loss functions
- activation functions
- the gradient descent algorithm
At the end, there will be an implementation FROM SCRATCH of a fully functioning neural net.
code: https://github.com/ahmedbesbes/Neural-Network-from-scratch
Using Deep Learning (Computer Vision) to Search for Oil and GasSorin Peste
Several areas of Earth with large accumulations of oil and gas also have huge deposits of salt below the surface. Salt bodies are known for their propensity to form nice oil traps. However, knowing where large salt deposits are precisely is very difficult. Professional seismic imaging still requires expert human interpretation of salt bodies. This leads to very subjective, highly variable renderings. More alarmingly, it leads to potentially dangerous situations for oil and gas company drillers. That's why the oil & gas industry is now employing AI-based approaches to automatically identify subsurface salt bodies. This presentation showcases how Deep Learning is used to scan underground seismic images, looking for potentially resource-rich areas.
Python code included and publicly available at:
https://github.com/neaorin/kaggle-tgs-challenge
The document discusses building 2D and 3D games with Ruby using low-level APIs. It covers topics like building 2D games with Ruby SDL, building 3D games with Ruby OpenGL, and whether Ruby is a legitimate player in the gaming space. Examples provided include sample code for sprites, events, and extensions to interface with C libraries for graphics and game development.
The document discusses building 2D and 3D games with Ruby using low-level APIs. It covers topics like building 2D games with Ruby SDL, building 3D games with Ruby OpenGL, and whether Ruby is a legitimate player in the gaming space. Examples provided include sample code for sprites, events, and extensions to interface with C libraries for graphics and game development.
This program allows a user to collect personal, educational, and professional information from a candidate to automatically generate a resume in rich text format (RTF). The program includes controls to dynamically add additional educational courses and work experiences. It collects information such as name, date of birth, address, education history, work experience, skills and generates an RTF resume file with the collected information.
This document discusses various techniques and optimizations from Apple's GameplayKit framework. It begins by introducing GameplayKit and explaining that it is used to develop gameplay mechanics rather than rendering. Several techniques are then presented as "Gems" including using GKRandomSource for shuffling arrays, GKRTree for performant visual searches, GKPerlinNoiseSource for natural randomness, and using GKObstacleGraph for pathfinding around obstacles. Links are provided at the end for further information on GameplayKit and related algorithms.
Gentle Introduction to Functional ProgrammingSaurabh Singh
This slide is basically aimed at professionals and students to introduce them with functional programming.
I haven't used much functional programming terminologies because I personally feel they could be overwhelming to people getting introduced to FP for the first time. For similar reasons I have deliberately avoided using any functional programming language and kept the discussions programming language agnostic as far as possible.
The document describes code that implements and tests a robot arena simulation GUI. It imports Tkinter for the GUI, sets up a canvas with obstacles, defines robot and traffic light objects. It then generates random routes for the robot to follow, moving it around the arena and changing the traffic light colors accordingly. The robot's movement is programmed through functions that adjust its coordinates on the canvas.
The Ring programming language version 1.8 book - Part 53 of 202Mahmoud Samir Fayed
The document describes running multiple threads that print output. Thread 1 prints numbers from 1 to 5. Thread 2 prints strings with asterisks and numbers. Thread 3 prints strings with exclamation marks and numbers. The output shows the interleaved output from the three threads running concurrently, demonstrating thread synchronization in Ring.
The document provides source code for generating and manipulating computer graphics using various algorithms. It includes algorithms for drawing lines, circles and curves, as well as algorithms for translating, rotating, and scaling two-dimensional and three-dimensional objects. The source code is written in C/C++ and uses graphics libraries to output the results. Various input parameters are taken from the user and output is displayed to demonstrate the algorithms.
Pygame is a set of Python modules for developing video games. It provides tools for creating surfaces, handling events, playing sounds, and more. The presentation introduces essential Pygame elements like surfaces, rectangles, display, and events. Surfaces represent images and allow manipulating pixels. Rectangles are used for collision detection. The display module handles the screen. Events represent user inputs. Pygame provides a simple and portable way to create games in Python.
Similar to Intro to Python (High School) Unit #3 (20)
Python 3.6 includes several new features and improvements related to asynchronous programming and language syntax. PEP 525 introduces asynchronous generators to allow async and await in generator functions. PEP 530 adds asynchronous comprehensions for concise creation of asynchronous iterators. Other PEPs improve class attribute definition order preservation, string formatting syntax, and the addition of asynchronous APIs to the standard library. Python 3.6 continues Python's progress towards native asynchronous programming capabilities.
An overview of two types of graph databases: property databases and knowledge/RDF databases, together with their dominant respective query languages, Cypher and SPARQL. Also a quick look at some property DB frameworks, including TinkerPop and its query language, Gremlin.
A Cosmic Hunt In The Berber Sky: An Introduction to Phylogenetic InferenceJay Coskey
1) Julien d'Huy studied variations of the myth of a man pursuing a deer that turns into the Big Dipper constellation, analyzing it with phylogenetic methods to reconstruct its evolution.
2) He identified 93 characteristics ("mythemes") across 47 versions of the myth and traced changes in the mythemes to build an evolutionary tree showing how the myth diverged over time with human migrations.
3) The analysis dates the protomyth or original version of the story to before humans crossed the Bering Strait land bridge, suggesting it began with Berber populations in North Africa.
Software Modeling of Contracts in Games and Finance, Part 1: 2018-01-10Jay Coskey
This document provides an overview and outline of modeling contracts in games and finance using software and machine learning. It discusses understanding contracts and their required traits, as well as contract languages like Solidity used for "smart contracts" on the Ethereum blockchain. Game contracts and assigning utility values to game states are also covered. The goal is to explore approaches for autonomous contract negotiation in games using machine learning.
Intro to Python for High School students, from basics up to built-in functions, recursion, and list/dict comprehensions. Does not include classes, which are in Unit #2.
Manyata Tech Park Bangalore_ Infrastructure, Facilities and Morenarinav14
Located in the bustling city of Bangalore, Manyata Tech Park stands as one of India’s largest and most prominent tech parks, playing a pivotal role in shaping the city’s reputation as the Silicon Valley of India. Established to cater to the burgeoning IT and technology sectors
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISTier1 app
Are you ready to unlock the secrets hidden within Java thread dumps? Join us for a hands-on session where we'll delve into effective troubleshooting patterns to swiftly identify the root causes of production problems. Discover the right tools, techniques, and best practices while exploring *real-world case studies of major outages* in Fortune 500 enterprises. Engage in interactive lab exercises where you'll have the opportunity to troubleshoot thread dumps and uncover performance issues firsthand. Join us and become a master of Java thread dump analysis!
Unveiling the Advantages of Agile Software Development.pdfbrainerhub1
Learn about Agile Software Development's advantages. Simplify your workflow to spur quicker innovation. Jump right in! We have also discussed the advantages.
Liberarsi dai framework con i Web Component.pptxMassimo Artizzu
In Italian
Presentazione sulle feature e l'utilizzo dei Web Component nell sviluppo di pagine e applicazioni web. Racconto delle ragioni storiche dell'avvento dei Web Component. Evidenziazione dei vantaggi e delle sfide poste, indicazione delle best practices, con particolare accento sulla possibilità di usare web component per facilitare la migrazione delle proprie applicazioni verso nuovi stack tecnologici.
Superpower Your Apache Kafka Applications Development with Complementary Open...Paul Brebner
Kafka Summit talk (Bangalore, India, May 2, 2024, https://events.bizzabo.com/573863/agenda/session/1300469 )
Many Apache Kafka use cases take advantage of Kafka’s ability to integrate multiple heterogeneous systems for stream processing and real-time machine learning scenarios. But Kafka also exists in a rich ecosystem of related but complementary stream processing technologies and tools, particularly from the open-source community. In this talk, we’ll take you on a tour of a selection of complementary tools that can make Kafka even more powerful. We’ll focus on tools for stream processing and querying, streaming machine learning, stream visibility and observation, stream meta-data, stream visualisation, stream development including testing and the use of Generative AI and LLMs, and stream performance and scalability. By the end you will have a good idea of the types of Kafka “superhero” tools that exist, which are my favourites (and what superpowers they have), and how they combine to save your Kafka applications development universe from swamploads of data stagnation monsters!
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...kalichargn70th171
Visual testing plays a vital role in ensuring that software products meet the aesthetic requirements specified by clients in functional and non-functional specifications. In today's highly competitive digital landscape, users expect a seamless and visually appealing online experience. Visual testing, also known as automated UI testing or visual regression testing, verifies the accuracy of the visual elements that users interact with.
Transforming Product Development using OnePlan To Boost Efficiency and Innova...OnePlan Solutions
Ready to overcome challenges and drive innovation in your organization? Join us in our upcoming webinar where we discuss how to combat resource limitations, scope creep, and the difficulties of aligning your projects with strategic goals. Discover how OnePlan can revolutionize your product development processes, helping your team to innovate faster, manage resources more effectively, and deliver exceptional results.
Malibou Pitch Deck For Its €3M Seed Roundsjcobrien
French start-up Malibou raised a €3 million Seed Round to develop its payroll and human resources
management platform for VSEs and SMEs. The financing round was led by investors Breega, Y Combinator, and FCVC.
DevOps Consulting Company | Hire DevOps Servicesseospiralmantra
Spiral Mantra excels in providing comprehensive DevOps services, including Azure and AWS DevOps solutions. As a top DevOps consulting company, we offer controlled services, cloud DevOps, and expert consulting nationwide, including Houston and New York. Our skilled DevOps engineers ensure seamless integration and optimized operations for your business. Choose Spiral Mantra for superior DevOps services.
https://www.spiralmantra.com/devops/
The Rising Future of CPaaS in the Middle East 2024Yara Milbes
Explore "The Rising Future of CPaaS in the Middle East in 2024" with this comprehensive PPT presentation. Discover how Communication Platforms as a Service (CPaaS) is transforming communication across various sectors in the Middle East.
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Paul Brebner
Closing talk for the Performance Engineering track at Community Over Code EU (Bratislava, Slovakia, June 5 2024) https://eu.communityovercode.org/sessions/2024/why-apache-kafka-clusters-are-like-galaxies-and-other-cosmic-kafka-quandaries-explored/ Instaclustr (now part of NetApp) manages 100s of Apache Kafka clusters of many different sizes, for a variety of use cases and customers. For the last 7 years I’ve been focused outwardly on exploring Kafka application development challenges, but recently I decided to look inward and see what I could discover about the performance, scalability and resource characteristics of the Kafka clusters themselves. Using a suite of Performance Engineering techniques, I will reveal some surprising discoveries about cosmic Kafka mysteries in our data centres, related to: cluster sizes and distribution (using Zipf’s Law), horizontal vs. vertical scalability, and predicting Kafka performance using metrics, modelling and regression techniques. These insights are relevant to Kafka developers and operators.
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
14 th Edition of International conference on computer visionShulagnaSarkar2
About the event
14th Edition of International conference on computer vision
Computer conferences organized by ScienceFather group. ScienceFather takes the privilege to invite speakers participants students delegates and exhibitors from across the globe to its International Conference on computer conferences to be held in the Various Beautiful cites of the world. computer conferences are a discussion of common Inventions-related issues and additionally trade information share proof thoughts and insight into advanced developments in the science inventions service system. New technology may create many materials and devices with a vast range of applications such as in Science medicine electronics biomaterials energy production and consumer products.
Nomination are Open!! Don't Miss it
Visit: computer.scifat.com
Award Nomination: https://x-i.me/ishnom
Conference Submission: https://x-i.me/anicon
For Enquiry: Computer@scifat.com
Consistent toolbox talks are critical for maintaining workplace safety, as they provide regular opportunities to address specific hazards and reinforce safe practices.
These brief, focused sessions ensure that safety is a continual conversation rather than a one-time event, which helps keep safety protocols fresh in employees' minds. Studies have shown that shorter, more frequent training sessions are more effective for retention and behavior change compared to longer, infrequent sessions.
Engaging workers regularly, toolbox talks promote a culture of safety, empower employees to voice concerns, and ultimately reduce the likelihood of accidents and injuries on site.
The traditional method of conducting safety talks with paper documents and lengthy meetings is not only time-consuming but also less effective. Manual tracking of attendance and compliance is prone to errors and inconsistencies, leading to gaps in safety communication and potential non-compliance with OSHA regulations. Switching to a digital solution like Safelyio offers significant advantages.
Safelyio automates the delivery and documentation of safety talks, ensuring consistency and accessibility. The microlearning approach breaks down complex safety protocols into manageable, bite-sized pieces, making it easier for employees to absorb and retain information.
This method minimizes disruptions to work schedules, eliminates the hassle of paperwork, and ensures that all safety communications are tracked and recorded accurately. Ultimately, using a digital platform like Safelyio enhances engagement, compliance, and overall safety performance on site. https://safelyio.com/
5. Turtle graphics — Introduction
This demo can give you an idea of what turtle graphics in Python is like. Explore!
python –m turtledemo # Take a look at the "Examples" menu
python –m turtledemo.clock
5License: CC BY-SA 4.0 (except images), by Jay Coskey
Turtle graphics dates back to
Seymour Papert (1928-2016)
who, in the '60s, added it to
an educational programming
language called Logo, which
he & a few others designed.
It involved moving a virtual
pen-holding turle that left
visible paths on the screen.
6. Turtle graphics — Source code
Importing "turtle" gives you access to classes such as Screen, Turtle, and many others.
Here is how to draw a square (which is a polygon with four sides).
6License: CC BY-SA 4.0 (except images), by Jay Coskey
import turtle
def forward_right(t, fval, rval):
t.forward(fval)
t.right(rval)
screen = turtle.Screen()
t = turtle.Turtle()
t.setheading(90) # Start facing ↑
for k in range(0, 4):
forward_right(t, 50, 90)
screen.mainloop()
7. Turtle graphics — Round things
If you draw a polygon with far more sides, the result looks more circle-ish.
7License: CC BY-SA 4.0 (except images), by Jay Coskey
import turtle
def forward_right(t, fval, rval):
t.forward(fval)
t.right(rval)
screen = turtle.Screen()
t = turtle.Turtle()
t.setheading(90)
NUM_SIDES = 12
for k in range(0, NUM_SIDES):
forward_right(t, 50, 360/NUM_SIDES)
screen.mainloop()
Start & end point
8. Turtle graphics — Pointy things
By switching from small jumps and small angle changes to large jumps and large angle changes,
the shapes generated become pointy.
8License: CC BY-SA 4.0 (except images), by Jay Coskey
import turtle
def forward_right(t, fval, rval):
t.forward(fval)
t.right(rval)
screen = turtle.Screen()
t = turtle.Turtle()
t.setheading(90)
POINTS = 12
for k in range(0, POINTS):
rval = (360/POINTS) * ((POINTS/2) – 1)
forward_right(t, 200, rval)
screen.mainloop() Start & end point
9. Turtle graphics — Wavy things
Changing the angle over time in a more complex way can generate more interesting shapes.
9License: CC BY-SA 4.0 (except images), by Jay Coskey
import turtle
def forward_right(t, fval, rval):
t.forward(fval)
t.right(rval)
def sine_ish(k):
return 45
+ 90 * math.sin(math.pi*k / 25)
screen = turtle.Screen()
t = turtle.Turtle()
t.setheading(90)
For k in range(0, 200):
forward_right(t, 30, sine_ish(k))
screen.mainloop()
Start & end point
10. Turtle graphics — Fractal things
Recursion can be used to generate fractals — shapes that are self-similar at different scales.
10License: CC BY-SA 4.0 (except images), by Jay Coskey
import turtle
def forward_right(t, fval, rval):
fractal(t, fval, 3, 1)
t.right(rval)
def fractal(t, dist, depth, dir):
# def from the fractalcurves demo
window = turtle.Screen()
t = turtle.Turtle()
t.setheading(0)
for k in range(0, 3):
forward_right(t, 150, 120)
window.mainloop()
Start & end point
This shape is known as
a "Koch snowflake",
after Helge von Koch
(1870-1924)
11. Turtle graphics — Pen width, color, up/down
• Let's revise the script square.py to make it more colorful.
License: CC BY-SA 4.0 (except images), by Jay Coskey 11
import random
import turtle
def forward_right(t, pcol, pwidth, fval, rval):
t.color(pcol)
t.width(pwidth)
for k in range(0, 10): # Break edge into 10 parts
d = random.randint(3, 7)
t.pendown()
t.forward(d * fval / 100)
t.penup()
t.forward((10 – d) * fval / 100)
t.right(rval)
if __name__ == '__main__':
(window, t) = (turtle.Screen(), turtle.Turtle())
t.setheading(90)
forward_right(t, 'red', 3, fval=400, rval=90)
forward_right(t, 'green', 6, fval=400, rval=90)
forward_right(t, 'blue', 9, fval=400, rval=90)
forward_right(t, 'black',12, fval=400, rval=90)
window.mainloop() Start & end point
12. Turtle graphics — absolute coordinates (2)
• Absolute coordinates can be used in pong-type games.
License: CC BY-SA 4.0 (except images), by Jay Coskey 12
import turtle
...
(wn, t) = (turtle.Screen(), turtle.Turtle())
...
while True:
if x < left_wall or x > right_wall:
dx = - dx
if y < bottom_wall or y > top_wall:
dy = - dy
x += dx
y += dy
t.goto(x, y)
13. Turtle graphics — absolute coordinates
• Turtle understands not only forward/back/left/right, but also goto.
License: CC BY-SA 4.0 (except images), by Jay Coskey 13
import turtle
def draw_line(t, x1, y1, x2, y2):
t.penup()
t.goto(x1, y1) # Starting point of line segment
t.pendown()
t.goto(x2, y2) # Ending point of line segment
if __name__ == '__main__':
(window, t) = (turtle.Screen(), turtle.Turtle())
t.hideturtle() # Don't show the turtle
t.speed(0) # Fastest; no delay between drawing
SCALE = 75
# Draw horizontal lines
draw_line(t, -3*SCALE, -SCALE, +3*SCALE, -SCALE)
draw_line(t, -3*SCALE, +SCALE, +3*SCALE, +SCALE)
# Draw vertical lines
draw_line(t, -SCALE, -3*SCALE, -SCALE, +3*SCALE)
draw_line(t, +SCALE, -3*SCALE, +SCALE, +3*SCALE)
window.mainloop()
goto sets the absolute coordinates of of the turtle.
The function setheading sets the absolute
direction. By default, it's measured in degrees.
Other related functions:
position (reads x & y); setx & sety (sets them)
heading (gets the current value of heading)
14. Turtle graphics — coloring by numbers
• Colors can be set by specifying values for red, green, and blue (r, g, b).
License: CC BY-SA 4.0 (except images), by Jay Coskey 14
import math
import turtle
def draw_arc(t, center, radius,
from_angle, to_angle, steps):
<...This uses penup, pendown, and goto...>
<...See the script, rainbow.py...>
(screen, t) = (turtle.Screen(), turtle.Turtle())
screen.delay(0) # Draw as fast as possible
angle_min = 10; angle_max = 170
arc_steps = 100
radius_min = 100; radius_max = 200; radius_steps = 300
screen.colormode(1.0) # Use values from 0 to 1.0.
for k in range(0, radius_steps + 1):
radius = radius_min + k*(radius_max-radius_min)/radius_steps
red = max(0, -1 + 2 * k / radius_steps) # 0-0-1
green = max(0, 1 - math.fabs(k - 128)/128) # 0-1-0
blue = max(0, 1 - 2 * k / radius_steps) # 1-0-0
t.color(red, green, blue)
draw_arc(t, (0, 0), radius, 30, 150, arc_steps)
screen.mainloop()
If you can produce a formula to
determine the coordinates of a curve,
then you can use goto to draw it.
For example, a circle can be drawn
using trigonometry:
x(t) = math.cos(t)
y(t) = math.sin(t)
You don't need to define your own
draw_arc function. Turtle provides a
similar function called circle, and
related functions begin_fill and
end_fill.
15. turtle graphics — events & actions
• Keyboard clicks and mouse clicks are examples of (software) events.
• Functions like onkey and onscreenclick register functions that are called
when certain events happen.
• Functions that don't return a value are sometimes called actions.
License: CC BY-SA 4.0 (except images), by Jay Coskey 15
Event
Keyboard click
Mouse click
Alarm clock going off
Action
Change turtle speed/direction
More turtle position
Change turtle color
Move game paddle
16. Turtle graphics — keyboard interactivity
The turtle "screen" ("window") used in turtle graphics can be set up to respond to keystrokes (or mouse clicks).
And it can handle more than one turtle at a time. Sounds like the beginning of a game….
16License: CC BY-SA 4.0 (except images), by Jay Coskey
import turtle
ANGLE=30; DISTANCE=25
def go_forward(t): t.foward(DISTANCE)
def go_left(t): t.left(ANGLE)
def go_right(t): t.right(ANGLE)
def go_back(t): t.back(DISTANCE)
def setup_keys(window, t,
up, left, right, down):
window.onkey(lambda: go_forward(t), up)
window.onkey(lambda: go_left(t), left)
window.onkey(lambda: go_right(t), right)
window.onkey(lambda: go_back(t), back)
window = turtle.Screen()
(t1, t2) = (turtle.Turtle(), turtle.Turtle())
# Set turtle colors
setup_keys(window, t1, 'e', 's', 'f', 'd')
setup_keys(window, t2, 'Up','Left','Right','Down')
window.listen()
window.mainloop()
t.shape(shapename) sets the shape of
the turtle: arrow, turtle, circle, square,
triangle, classic, or one of your own shapes.
t.color(pen_color, fill_color)
sets the color of the pen/path, and the color
of the turtle. They can also be set separately.
Also see the turtle demo "two_canvases".
17. Turtle graphics — mouse interactivity
The turtle Screen can also respond to mouse clicks… but it might be better to use tkinter for this.
17License: CC BY-SA 4.0 (except images), by Jay Coskey
# Partial script
import math
import turtle
(tgt_x, tgt_y) = (100, 0)
def set_tgt_coords(x, y):
global tgt_x # Use the variables tgt_x, tgt_y defined above.
global tgt_y
(tgt_x, tgt_y) = (x, y)
(wn, t) = (turtle.Screen(), turtle.Turtle())
wn.onscreenclick(set_tgt_coords)
wn.listen()
while True:
speed = 1
move_turtle_toward_target(t, speed) # Code not shown here
18. Turtle graphics — Conclusion
This is a tiny portion of what can be done with turtle graphics. It also supports the
addition of text, using a "fill color", etc. Don't forget about the turtledemo module!
18License: CC BY-SA 4.0 (except images), by Jay Coskey
Round things
Pointy things
Your things
Insert
your
masterpiece
here
Fractal thingsWavy things
20. tkinter & turtle (1)
• Turtle programs create a new window to
display their graphics.
• How do they do this? They use a Python
package called tkinter, which focuses on the
handling of windows and their contents.
License: CC BY-SA 4.0 (except images), by Jay Coskey 20
• tkinter is based on an earlier "widget toolkit" called Tk, which was first
released in 1991, by John Ousterhout.
• Fun (?) fact: John Ousterhout was the 1987 winner of the Grace Murray Hopper award.
• The first winner of this award, in 1971, was Donald E. Knuth.
• The 1979 winner was Steve "Woz" Wozniak, who co-founded Apple with Steve Jobs.
• The 1993 winner was Bjarne Stroustrup, who invented the C++ programming language.
21. tkinter & turtle (2)
• Here is an example of a
very simple app that uses
both tkinter and turtle.
License: CC BY-SA 4.0 (except images), by Jay Coskey 21
22. tkinter & turtle (3)
• Tkinter/turtle apps can also
interact with resources on
your computer, or with
others over the internet .
• There are modules available
for everything. If you can
imagine it, there's some way
to do it.
License: CC BY-SA 4.0 (except images), by Jay Coskey 22
###############
#S# # #
# # ### ### # #
# # # # # #
# ### # ### # #
# # # # #
# ### ### # #
# # # ### #
# # ### # # # #
# # # # # # #
# # # # # # #
# # # # ##### #
# # #F #
###############
23. Tkinter — Hello, world!
# From docs.python.org/3/library/Tkinter.html
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.pack()
self.create_widgets()
def create_widgets(self):
self.hi_there = tk.Button(self)
self.hi_there["text"] = "Hello Worldn(click me)"
self.hi_there["command"] = self.say_hi
self.hi_there.pack(side="top")
self.quit = tk.Button(self, text="QUIT", fg="red",
command=root.destroy)
self.quit.pack(side="bottom")
def say_hi(self):
print("hi there, everyone!")
root = tk.Tk()
app = Application(master=root)
app.mainloop()
License: CC BY-SA 4.0 (except images), by Jay Coskey 23
Place the "hi_there" button in its parent "frame".
Put all the quit button info in this one statement.
Create a button. Set the button's text.
Loop forever, listening for button clicks. Without this, the program quickly exits.
Set the function to be executed on button click.
Create and initialie the application window.
Place the quit button in its parent "Frame".
Create the application window or "frame".
24. tkinter layout/geometry managers
• The last example had few controls. Richer user experiences are more complex.
• tkinter provides three ways of controlling the location of the widgets.
• place — This Layout Manager is toooo complicated (for most "use cases")
• This requires you to specify the coordinates of each widget being placed. And it doesn't carry over
well to the event when a window is resized by the user. It'll drive you nuts.
• pack — This Layout Manager is toooo simple (for some "use cases")
• This works by declaring for each widget which side(s) of the containing frame it's pushed up against
(top, bottom, left, and right). This can work for some layouts, but when you want to do something
that involves two sides at once (e.g., having two scroll bars meet in the lower-right corner, but
leave a blank space, you'll wish you had chosen grid.
• grid — This Layout Manager is juuuust right
• You specify a 2-D grid of cells, and declare which widgets lie in which cells. (Think checkers/chess.)
Note: Some widgets (e.g., Frame) can contain other widgets, which can contain others.
This allows for more complicated layouts (e.g., a Monopoly board).
License: CC BY-SA 4.0 (except images), by Jay Coskey 24
25. A simple Tkinter layout
License: CC BY-SA 4.0 (except images), by Jay Coskey 25
Chatterbox — □ X
Menubar reserved for menus
"Dashboard area", for the display
the current state of the program.
"Control area", for changing
the state of the program.
Any layout manager can work here, but as
the user experience gets more complex,
some layout managers become easier to
use than others….
26. Erik> Wassup?
Update
Available Tkinter controls/widgets
License: CC BY-SA 4.0 (except images), by Jay Coskey 26
File | Edit |
Chat name: Thorvald Asvaldsson
Connected as:
Send
Message: Not much. Just trying to stay warm.
Thorvald Asvaldsson
Chatterbox — □ X
Disconnect
○ Broadcast to all
● Send to individual
Send to: Erik
Menubar with two menus
Label and (text) Entry controls
Text control
Scrollbar control
Lable, Entry, and Button controls
Radiobutton, Label, "Dropdown"
Button
For more info, see https://docs.python.org/3/library/tk.html and http://tkinter.unpythonic.net/wiki/
and https://docs.python.org/3/library/tkinter.ttk.html
27. tkinter widgets!
• tkinter has many controls/widgets available to build a GUI with.
License: CC BY-SA 4.0 (except images), by Jay Coskey 27
Canvas
Checkbutton
Frame
(text) Entry
Button
Label
Listbox
Message
Menubutton
Menu
Text
Scrollbar Scale
Radiobutton
LabelFrame
Toplevel
Spinbox
PanedWindow
28. tkinter.ttk — More widgets!
• If you're going to use tkinter for your Course Project, check out some
of these other widgets that are available outside of tkinter.
from tkinter import ttk
ttk widgets available:
Combobox
Notebook
Progressbar
Separator
Sizegrip
Treeview
License: CC BY-SA 4.0 (except images), by Jay Coskey 28
Note: tkinter.ttk replaces an
older module called tkinter.tix.
29. Other desktop GUI options
• Again, tkinter is based on the widget toolkit Tk, which was first released in 1991.
• Tkinter has long come bundled with Python. But there are other GUI packages available.
• Kivy (multi-touch-enabled media rich apps; successor to the PyMT project; MIT license)
• Written (from scratch?) by the Kivy foundation; first released in 2011
• Libavg
• Based on OpenGL, which was first released in 1992
• PyGi
• Based on the GNOME platform, first released in 1999
• PyQt (GPL license) and PySide (LGPL license)
• Based on the Qt toolkit, first released in 1995
• wxPython and gui2Py (which is based on wxPython)
• Based on wxWidgets, which was first released in 1992
License: CC BY-SA 4.0 (except images), by Jay Coskey 29
31. "ReachOne" step count visualization
# See Question 2(b) on HW #4.
import matplotlib.pyplot as plt
def reachone_next(n: int) -> int:
result = n / 2 if n % 2 == 0 else 3 * n + 1
return result
def reachone_count(n: int) -> int:
count = 0
while n > 1:
count += 1
n = reachone_next(n)
return count
xs = range(1,10001)
ys = [reachone_count(x) for x in xs]
plt.scatter(xs, ys)
plt.show()
License: CC BY-SA 4.0 (except images), by Jay Coskey 31
Look — a pattern! One that
would not have become
apparent, except through
such a visualization.
32. Palindrome step count visualization (1)
def is_palindrome(n):
return str(n) == str(n)[::-1]
def reachpalindrome_next(n):
return n + int(str(n)[::-1])
def reachpalindrome_step_count(n):
count = 0
while not is_palindrome(n):
count += 1
n = reachpalindrome_next(n)
return count
License: CC BY-SA 4.0 (except images), by Jay Coskey
32
Let's try something similar, but
• Have the "step" be reversing the digits of a number and adding the reversed number to the original
• Repeat until the result is a palindrom, and count the number of steps until that happens.
If we use the number 176 as
an example, it takes 5 steps to
reach a palindrome.
0: 176
1: 176 + 671 = 847
2: 847 + 748 = 1595
3: 1595 + 5951 = 7546
4: 7546 + 6457 = 14003
5: 14003 + 30041 = 44044
33. Palindrome step count visualization (2)
import matplotlib.pyplot as plt
<... functions as on previous slide ...>
pxs = range(1,101)
pys = [reachpalindrome_step_count(px) for px in pxs]
plt.scatter(pxs, pys)
plt.title('ReachPalindrome steps')
plt.xlim(-1,101)
plt.ylim(-1,25)
plt.xlabel('Value')
plt.ylabel('Step count')
for px in pxs:
if pys[px - 1] > 10:
py = pys[px - 1]
plt.annotate('({0},{1})'.format(px,py),
xy=(px,py), xytext=(px-50,py-5-(px-89)),
arrowprops=dict(facecolor='black',shrink=0.05))
plt.show()
License: CC BY-SA 4.0 (except images), by Jay Coskey
33
The matplotlib package has support for a broad range of means of visualizations.
• We can add titles, labels, annotations, etc.
• It looks like there are patterns in this "scatterplot" that could lead to other insights….
34. Q: Why visualize? A: Anscomb's Quartet
• Anscombe's Quartet doesn't have any violins.
• It's four sets of 11 points each, created in 1973 by
English statistician Francis Anscombe (1918-2001).
• Each set has means (x & y coords), variances (x & y),
x-y correlations, and best-fit line as each other set.
• So if you only look at aggregated statistics, each set
looks exactly the same as all the others.
• But if you look at the scatter plots of these sets, then
they all look quite distinct.
• Moral of the story: Visualize your data to better
understand it. There might be more to the story.
License: CC BY-SA 4.0 (except images), by Jay Coskey 34
You won't come across one of the data sets in Anscombe's Quartet, but a common
occurrence is that your dataset looks like it's made up of two or more datasets
superimposed. It might make sense to break them apart and study each one separately.
35. What is the Mandelbrot set?
• There's a famous 2-D set in mathematics called the Mandelbrot set (Benoît Mandelbrot,
1924-2010). It's defined similarly—in terms of the number of iterations of a function.
License: CC BY-SA 4.0 (except images), by Jay Coskey
35
The idea is simple. Take a particular simple function defined
for all points on the (complex) plane. Call it f.
• For some points p near the origin, all iterations of f (i.e.,
f(p), f(f(p)), f(f(f(p))), etc. remain near the origin.
• For some other points, iterations of f quickly zoom
outward, getting further & further from the origin.
• For points inbetween, the pattern is very complex.
def mandelbrot_iter_count(x, y, iterations_max):
z = 0
c = x + 1j*y # Note: 1j = math.sqrt(-1)
iterations_until_divergence = iter_max
for k in range(1, iter_max):
z = z*z + c
if abs(z) > 2: # Divergence
iterations_until_divergence = k
break
return iterations_until_divergence
To create the Mandelbrot set, color by numbers:
• For the points on the plane that always stay
near the origin—give them one color.
• For points that quickly zoom away, give them
another color.
• For points inbetween, given them a color that
transitions from one to the other.
36. Mandelbrot set visualization
• I wonder if Mandelbrot liked almond bread. Anyhow, where were we?
License: CC BY-SA 4.0 (except images), by Jay Coskey
36
import matplotlib.pyplot as plt
import numpy as np
def mandelbrot_iter_counts(xmin, xmax, ymin, ymax, nx=500, ny=500, iter_max=500):
dx = (xmax-xmin) / (nx-1)
dy = (ymax-ymin) / (ny-1)
xs = [xmin + i*dx for i in range(nx)]
ys = [ymin + i*dy for i in range(ny)]
return [[mandelbrot_iter_count(x, y, iter_max) for x in xs] for y in ys]
if __name__ == '__main__':
plt.figure()
bounds_all = [-1.6, 0.6, -1.1, 1.1] # The entire set
bounds_a = [-1.0, -0.5, 0.0, 0.3] # Zoom in
bounds_b = [-0.78, -0.73, 0.02, 0.08] # More zoom
bounds_c = [-0.752, -0.749, 0.031, 0.0335] # Enhance!
(xmin, xmax, ymin, ymax) = bounds_all
(nx, ny, iter_max) = (100, 100, 100)
plt.imshow(np.array(mandelbrot_iter_counts(xmin,xmax,ymin,ymax,
nx,ny,iter_max)),
extent=(xmin,xmax,ymin,ymax), origin='lower')
plt.show()
Note: numpy is used for many high-performance computations
37. More data visualization with matplotlib
• We've barely scratched the surface of matplotlib.
• Check out the gallery of matplotlib visualizations at http://matplotlib.org/gallery.html
• You can click on any of these visualizations to get the underlying source code.
• There are other visualization libraries in Python, including Bokeh (http://bokeh.pydata.org/),
which focuses on interactive display. Of course, Bokeh has its own gallery.
License: CC BY-SA 4.0 (except images), by Jay Coskey
37
38. Jupyter (was IPython notebook) (1)
• Jupyter is a way of using Python with (distributed) interactive notebooks.
• See https://ipython.org/ipython-doc/3/interactive/ for the details.
License: CC BY-SA 4.0 (except images), by Jay Coskey 38
• Your script becomes a notebook
made of a kernel and console.
• A notebook has cells that are chunks
of code that can be edited, run, or
moved around as needed.
• This is a very handy environment,
especially for data analysis, where
there is often a linear flow of
execution involving:
• Creating a data model (e.g., weather)
• Refining & evolving the model
• Running & evaluating the model
• Outputting summary information
39. Jupyter (was IPython notebook) (2)
• To run Jupyter on your laptop, run the command
ipython notebook
• There are many public Jupyter notebooks over at
• http://nbviewer.jupyter.org/
License: CC BY-SA 4.0 (except images), by Jay Coskey 39
And there's even more available at github.com.
IPython notebooks (.ipynb) files checked into
github.com can be viewed as IPython notebooks.
Just search on Google for
filetype:ipynb site:github.com
Example: You can make Deep Dream images using
https://github.com/google/deepdream/blob
/master/dream.ipynb
nbviewer uses
nbconvert.
Notebooks can
be converted
to HTML, PDF,
or a regular
Python file.
41. A few more Python language features
• Class inheritance and multiple inheritance:
• https://docs.python.org/3/tutorial/classes.html#inheritance
• "Context managers" (i.e., scoped resources) using "with" statements
• https://www.python.org/dev/peps/pep-0343/
• Decorators
• https://www.python.org/dev/peps/pep-0318/
• https://python-3-patterns-idioms-test.readthedocs.io/en/latest/PythonDecorators.html
• https://dbader.org/blog/python-decorators
• Exceptions (a common means of error handling)
• https://docs.python.org/3/library/exceptions.html
• Iterables, iterators, and generators
• http://www.python-course.eu/python3_generators.php
• Parameter packing and unpacking (*args and **kwargs)
• http://thepythonguru.com/python-args-and-kwargs/
• Aynchronous features (:
• https://docs.python.org/3/library/asyncio.html
• https://www.youtube.com/watch?v=M-UcUs7IMIM
License: CC BY-SA 4.0 (except images), by Jay Coskey 41
42. Additional resources
• CherryPy (Introduction to web development in Python)
• http://cherrypy.org/
• Python the Hard Way:
• https://learnpythonthehardway.org/book/
• Python 3 Patterns, Recipes, and Idioms
• https://media.readthedocs.org/pdf/python-3-patterns-idioms-test/latest/python-3-
patterns-idioms-test.pdf
• Python's numerical and scientific libraries
• numpy, scipy, pandas (data structures & analysis), astropy (astronomy), sympy
(symbolic mathematics), scikit-learn (AI-type library, using "machine learning")
• Machine learning (think "artificial intelligence") using Python
• http://scikit-learn.org/stable/
• Teach Yourself Programming in Ten Years
• http://norvig.com/21-days.html
License: CC BY-SA 4.0 (except images), by Jay Coskey 42
Editor's Notes
The "Pointy things" image reminds me of this Alessi clock, called "Blow Up":
http://www.alessi.com/en/products/detail/fc16-blow-up-wall-clock
Cf. Goldilocks and the Three Bears.
Asvald "from Vest Agder" (b. 780)
Oxen-Thorir Asvaldsson (b. 810) (brother of Naddoddur, who discovered Iceland when he was sailing from Norway to the Faroe Islands)
-> Ulf Oxen-Thorisson (c. 850, Norway)
-> Asvald(ur) Ulfsson (c. 880)
-> Thorvald Asvaldsson (c. 930, Norway)
- Exiled from Norway c. 960 for manslaughter.
- Went to Iceland w/ son Erik, and died there before 980.
-> Erik Thorvaldsson (Erik the Red) (c. 940/950 – c. 1003)
- prob. born in Icelandic
- Exiled for 3 years for killing Eyiolf the Foul
- "Discovered" & colonized Greenland
o Greenland was actually sighted about a century earlier, by Norseman Gunnbjorn Ulfsson
when he was blown off course while headed from Norway to Iceland.
It was settled shortly thereafter by Norseman Snaebjorn Galti c. 900.
-> Leif Ericson (c. 970 – c. 1020) (visited North America)
The "Dropdown" control is actually called an OptionMenu.
Asvald "from Vest Agder" (b. 780)
Oxen-Thorir Asvaldsson (b. 810) (brother of Naddoddur, who discovered Iceland when he was sailing from Norway to the Faroe Islands)
-> Ulf Oxen-Thorisson (c. 850, Norway)
-> Asvald(ur) Ulfsson (c. 880)
-> Thorvald Asvaldsson (c. 930, Norway)
- Exiled from Norway c. 960 for manslaughter.
- Went to Iceland w/ son Erik, and died there before 980.
-> Erik Thorvaldsson (Erik the Red) (c. 940/950 – c. 1003)
- prob. born in Icelandic
- Exiled for 3 years for killing Eyiolf the Foul
- "Discovered" & colonized Greenland
o Greenland was actually sighted about a century earlier, by Norseman Gunnbjorn Ulfsson
when he was blown off course while headed from Norway to Iceland.
It was settled shortly thereafter by Norseman Snaebjorn Galti c. 900.
-> Leif Ericson (c. 970 – c. 1020) (visited North America)
A comparison of PyQt and wxPython, including source code examples:
https://opensource.com/article/17/4/pyqt-versus-wxpython
As of April, 2017, wxPython still does not support Python 3.
There are some excellent Jupyter notebooks available at
http://nbviewer.jupyter.org/github/donnemartin/interactive-coding-challenges/tree/master/
There are some excellent Jupyter notebooks available at
http://nbviewer.jupyter.org/github/donnemartin/interactive-coding-challenges/tree/master/
Different ways of achieving async in Python:
https://quentin.pradet.me/blog/what-color-is-your-python-async-library.html
Splitting images into smaller images:
https://www.reddit.com/r/learnpython/comments/2jlv1e/python_script_to_take_an_image_and_cut_it_into_4/
A Neural Network in 11 Lines of Python (Part 1):
http://iamtrask.github.io/2015/07/12/basic-python-network/
Playing music using Python:
https://www.reddit.com/r/Python/comments/63ioos/python_music_player/
Single-image cheatsheet on Python for big data:
https://i.redd.it/jcrdi4piruqy.png