~ OOP,Classes,Python,Tkinter ...recreating PONG


Recreating the classic game PONG! Step 1: Setting up the game canvas

Ready? Make a note of the information below and then get started on the challenges

Pong is one of the earliest arcade video games. It is a table tennis sports game featuring simple two-dimensional graphics. The game was originally manufactured by Atari, which released it in 1972. Allan Alcorn created Pong as a training exercise assigned to him by Atari co-founder Nolan Bushnell. Bushnell based the idea on an electronic ping-pong game included in the Magnavox Odyssey, which later resulted in a lawsuit against Atari. Surprised by the quality of Alcorn's work, Bushnell and Atari co-founder Ted Dabney decided to manufacture the game. We won't be creating the entire game but using the concept to get to grips with object orientated programming and the use of classes. Below is a cool video on "Gaming through time"

Code and Challenge

Copy and paste the code below. Run it! Read the task and see if you can do it before moving on to the next challenge

"""
===========Task==============
1. Type this out for yourself to familiarise yourself with the setup
2. Change the variables/parameters and have a play around - e.g. Game title, background colour, etc

"""

from tkinter import *
import random
import time
tk=Tk() #creating a tk object
tk.title("My 21st Century Pong Game") #give the window a title, using the title function of the tk object
tk.resizable(0,0) #resizable makes the window a fixed size
tk.wm_attributes("-topmost",1) #the wm_attributes tell tkinter to place *this* window infront of all other windows
canvas=Canvas(tk,bg="red",width=500,height=400,bd=0,highlightthickness=0) #create canvas and create a few additional features, passing in parameters for border and thickness
canvas.pack() #tells the canvas to size itself according to the width and height parameters just given
tk.update() #update tells tkinter to initialise itself for the animation in the game to come - this last line is very important as otherwise things wouldn't quite work correctly!


Code your solution here

Systems Life Cycle (in a nutshell): Analyse - Design - Create - Test - Evaluate. Designing something or writing out some pseudocode before you actually write code is always a good idea! Get in to the habit of doing so! You can draw your flowchart here and screenshot it.

A sample flow chart (design) for this particular challenge could look like:

Flowchart: Python program to get the Fibonacci series between 0 to 50
Each challenge section below provides an online drawing tool where you can dynamically create flowcharts. Screenshot them into your presentation for submission.

Solutions & Answers

Answers /Solutions in the "members area" drive under: "Solve and Learn >>SOLUTIONS"

Testing Table

You may want to read a little about Testing first. A teacher may go through some examples with you. Feel free to fill in the test table here, and screenshot it in to your powerpoint. Testing is absolutely essential once you have created a program!
Test No. Description Test Data(input) Expected Outcome Actual Outcome Further Action?
1
2
3
4
5
Coming soon!