Course Home
Announcements
Check Yourself
Python Errors in English
CodeSkulptor FAQ
Reflections

Online Lessons

Related Links

Online Development

Lessons

Reference

What's next?

Congratulations on completing Python: Games to Google!

Here are some ideas for continuing your adventures in coding:

  • Continue with Codecademy
  • Start or continue with CodingBat
  • Want to learn Java or develop your Java skills further? Check out Greenfoot.org. Greenfoot is a development environment for Java.
  • CTD generally offers a Java programming class in the fall (starting in October) for students in grades 6-8.
  • There is also an Introduction to Java Programming Honors course offered by CTD in the summer. Check the CTD catalog for more information about credit and prerequisites.

Friday, August 5

EXPO! Today!

Your priority for your EXPO! project should be to save a version that works, even if it doesn't have all the features you want to add. Remember, there is no such thing as an ultimate version of Word, or Excel, or Minecraft, or Windows. There are just versions. In general, users would rather have you fix bugs before adding any features.

Lunch begins at 11:00, so you'll need to start lining up at 10:40.

What We Have Done

Codecademy, CodingBat, CodeSkulptor, Monty Python

What We Have Learned

Math and Physics

  • Variables
  • Operators (arithmetic, comparison, boolean)
  • Functions
  • Coordinate Systems
  • Boolean Logic
  • Modular Arithmetic
  • Vectors (position, velocity, acceleration)
  • Collision detection

Programming Paradigms

  • Imperative Programming (trinket.io)
  • Procedural Programming (Codecademy)
  • Functional Programming (CodingBat)
  • Object-oriented Programming (Classes in Codecademy and CodeSkulptor)
  • Event-driven Programming (CodeSkulptor SimpleGUI)

Programming Concepts

  • Basic syntax and semantics of Python
  • Variables and data types (numbers, strings, booleans, lists, tuples)
  • Expressions and assignments
  • Conditional and iterative control structures (if, elif, else, for, while)
  • Functions and parameter passing

What will happen with my tjleone.com account?

The number of tjleone.com accounts that I can set up is limited. Some time over the next couple of weeks, I"ll need to remove the Google accounts I created for you so I can add students for other courses. If you have anything on your tjleone.com account that you don"t want to lose, be sure to save it. If you want to keep in touch with any classmates after this summer, be sure to exchange more permanent email addresses.

What do we do when we"re done with our Expo projects?

Once you have a version that is complete, test it for bugs. Then ask someone else to test it. When you are satisfied that it is ready to demo, save your demo version. After that, you can work on adding features, or do some Codecademy, CodingBat, or continue working through the Google material on the course web site (Lists, Dictionaries, List Comprehensions, File I/O, Regular Expressions, Utilities).

You can also work on any Codecademy or CodingBat exercises you haven"t completed.

Another thing you can work on is An Introduction to Interactive Programming in Python (Part 1) on the Coursera web site.

You can check out Google's Python Class.

If you"re interested in working with Python locally (not on the web with CodeSkulptor), see the sections below.

Using Python Locally on a PC

Using Python Locally On a Mac

Tkinter

SimpleGUI is not available on standard installs of Python. The video below introduces two modules (Tkinter and turtle) that you can use to get some interesting graphics on your local version of Python.

CodeSkulptor provides the SimpleGUI module for interactive programs. However, SimpleGUI is available only inside CodeSkulptor. tkinter is a commonly-used (but significantly more complex) module for interactive programs in Python. The following resources describe how to port programs from SimpleGUI to tkinter.

Examples of converting SimpleGUI code into tkinter, Bill, Fall 2012 & Spring 2013

The examples in this section are from CodeSkulptor docs built by John Greiner. I don"t know who Bill is. --TJ

Here are some examples of converting code from using SimpleGUI to Python's default GUI, tkinter. I"m not a programmer so don"t expect any coding wizardry, but I think these examples will help people looking for a different GUI they can use outside this class. To use these you"ll need to go to the CodeSkulptor link and copy the code into a new window in IDLE or another Python environment. I suggest naming them like I did, but that's up to you. These were coded in Python 3.2.3. Python 3 uses the module name tkinter, whereas Python 2 uses the module name Tkinter. Thus, you"ll need to edit the module name to run in Python 2. In later examples, I"ll show you how to write your code to run in both versions without an edit.

Remember that while the example programs are provided as CodeSkulptor links, they will not run in CodeSkulptor since they use tkinter, not SimpleGUI.

sg_tick_tkinter.py Converts Scott Rixner's SimpleGUI tick function to use tkinter. Details
sg_tick_tkinter_add_tb.py Introduces two new tkinter widgets: Frame and Text. Details
sg_calculator_tkinter.py Demonstrates tkinter widgets Frame, Button, Label, Entry, Text and Scrollbar by converting Joe Warren's calculator example to tkinter. Details
sg_calculator_tkinter_error_check.py Adds Python error checking for divide-by-zero and for non-numerical input. Student project: Extend the error-checking messages. Details
sg_calculator_tkinter_fonts.py Adds font support for Buttons and shows Scrollbar layout error. Details
sg_calculator_tkinter_fonts_layout.py Uses multiple frames to fix the scrollbar problem. Details
sg_welcome.py Converts the Codeskulptor “Welcome!” home page to tkinter. Introduces the Canvas widget and writing text to the canvas. Details
import_example.py Explains import library vs. import library as x vs. from library import * and shows a sample error. Details
z_flag_norway_sudan.py Draws line and polygon shapes to make flags on two Canvas widgets. Runs in both Python 2 and Python 3 without edits. Details
z_flag_maldives.py Adds more shapes on the Canvas. Introduces drawing arcs, ovals, and circles andetting a closer color match. Details
tk_radiobutton_example.py Introduces the Radiobutton widget, shown in two modes. This is a very important widget for many forms. Details
tk_graphical_rpsls.py Converts “Rock-Paper-Scissors-Lizard-Spock” (RPSLS) project to tkinter, with basic graphics. Includes a Scott Rixner mode. Details
tk_gtn.py Graphical version of “Guess the Number” project. Much better layout of Canvas and Frame (Figured THAT out, finally.) Details
tk_scale_0.py Per a request from a student, I made a demo of the Scale widget. You can use this in “Guess the Number” to avoid input errors, plus learn another cool graphical interface. Details
tk_list_selection_example_0.py Demonstrates capturing mouse clicks, per a student request. Details

Thursday, August 4

End of Course Survey

First order of business today is to take the course survey.

Self-Evaluation

We can do self-evaluations right after lunch.

Beta Version 2.0 of Basketball Game

Here is the version completed on August 3

Wednesday, August 3

I"m seeing some really cool Expo project happening! Once you have completed your Expo project, here are some things you can do:

  • Add a splash page and directions to your game
  • Help someone else with their project
  • Do some more Codecademy exercises
  • Do some CodingBat exercises
  • Look over our latest Pong and see if you can take it further
  • Start another Expo project

Collision with Base Classes

Here's how to use base classes to recognize collisions

Animation

Here's a short animation.. For details on how it works, see the bottom six videos of the More Codeskulptor page

Beta Version 1.0 of Basketball Game

Here's the basketball team's work in progress.

Tuesday, August 2

Completing the Journey

This morning I want to begin by talking about astronauts and the work that remains for the rest of this course and beyond.

Jumping

Here is an example of a circle that jumps when you press the space bar.

Shooting

Here is some starter code for a shooting game

Behavioral Change Followup

I"ll be checking in with people throughout the day on behavioral change issues from yesterday's survey. Note for people who are struggling with goal-setting: If you have completed less than 33% of the Python exercises in Codecademy, you should spend this morning on Codecademy. Otherwise, you should work on an Expo project. If you"re not sure what to work on, you can look at the example projects and student projects from last session or you can ask someone else for ideas. You can work on your own or with others.

Suggestions for People Feeling Excluded

Here are some of the suggestions students had for anyone who is feeling excluded:

  • Just walk away
  • Try to connect using something I and maybe the group likes or just do something i like and not care about them and not let them bother me.
  • I can try to comment on some conversations that are going on.
  • I go to a friend
  • What I like to do is to just count to ten and to just relax because no one is attacking me or hurting me in a way so I just try to calm down.
  • i do something else which is usually a video game and if it is a video game then i switch games
  • Listen to music(?)
  • I go bug my brother when I feel excluded.
  • I would talk to someone about what I feel like and what I have a problem with. I usually helps for people to talk to a friend or a trusted adult.
  • I can ask people if I can play the game that they"re playing with them.
  • I try not to think about what I am being excluded from, because it just makes me feel worse, and I go to some other people or place where I am included.

What's next for Pong?

From the work we did yesterday, we now have Pong with ball bouncing off of a paddle.. The code we have now is more elegant because of questions raised and contributions made you, and I have been amazed at the level of understanding I"ve seen of the project so far. If we have time tomorrow or Thursday, we"ll continue working on it together in small groups. For today, I want to make sure that everyone has a goal and a work plan for their Expo and that everyone is getting the support they need to complete it. If we run out of time, I"ll make video available on my web site to walk you through the rest of the development process.

Base classes

One thing that might help with your project are some base classes I wrote for CodeSkulptor projects. You can use them to...

Monday, August 1

Behavioral change

This morning we"ll take a short survey on behavioral change and inclusion and start sharing strategies to make our environment more enjoyable and productive.

Pong so far

This morning, we"ll review how the ball and paddle are placed on the screen. We"ll need this information in order to detect collisions.

Jigsaw teams

I"ll demo Ponng for people who have never played it. We will also look over this version of Pong based on the work that everyone has done so far.

Here are the jigsaw teams:

  • ["Dan", "Sidharth", "Mi'kel"]
  • ["Iman", "Max", "Lucas"]
  • ["Alex", "Samantha", "Ege"]
  • ["Omar", "Connor", "Elisa"]
  • ["Eave", "Liam", "Gabe"]
  • ["Prince", "Nik", "Henry"]

Friday, July 29

Self-Evaluation

Fill out this form to let me know how you feel about your progress so far.

Dropbox

How should we manage Dropbox so that everybody can find what they need? Folders by person? By resource? What needs to go onto Dropbox?

Pong continued

We have a paddle on our Pong table. This morning I"ll get with the Ball group to get the ball bouncing around the table starting with this template. Then we"ll get the Score group together to add a single score and collision detection. Finally we"ll get together in jigsaw groups today or Monday to finish off the game! If you"re not working with TJ on your Pong piece, your task is to finish classes, then complete any unfinished Codecademy exercises. Nobody has completed all 278 Python exercises, so you"ll all have some Codecademy to work on.

Expo

Good things to show for Expo include Codecademy, CodingBat, Pong, and anything else you build in CodeSkulptor. You can choose to build projects on your own or in teams.

Next week, I"ll share some classes that students found useful in building their Expo projects. In the meantime, people who have completed the unit on classes in Codecademy might want to start looking at examples and student work from last session:

Course Examples from Session 1

A lot of our examples start with this simplegui template.

Student Creations from Session 1

Thursday, July 28

There's been some interest in adding images to CodeSkulptor apps. Let's look at an example of a background image and add a character on top of it.

Here is a project from session 1 with moving images

Here is an app with an image loaded from Dropbox

Today we"ll continue working through Pong. I"ll start with the Scoreboard team. Paddle team and Ball team should keep plugging on Codecademy exercises on classes if you haven"t finished them yet. When you"re done with classes, you can go back and work on getting your piece of Pong working. You might also want to start thinking about how the different pieces are going to work together.

Scoreboard Team

Your assignment is to make sure every member of your team has a CodeSkulptor program that displays a counter that is updated by pressing a button. You should be able to reset the counter to 0 by pushing a button.

Team members: ["Ege", "Lucas", "Elisa", "Mi"kel", "Edward", "Gabriel"]

Work in pairs. Start with the opening CodeSkulptor page.

  1. Change the variable name message to the word score everywhere in your code.
  2. Make sure the code still works.
  3. Instead of setting score to "Welcome", set it to 0.
  4. Try running your code. What happens?
  5. Use the str function to change your draw handler as shown below.

        def draw(canvas):
                canvas.draw_text(str(score), [50,112], 48, "Red")

Change your button handler to add points to the score:


                def click():
                        global score
                        score += 1

Test out your code. Does the score go up when you click?

Something else to try

Can you change your code so to use a timer to increase the score instead of the button handler?

Preparation for integration of pieces of Pong

We need some standard variable names and a standard playing table to be able to put our pieces together. Here's a template for the ball team. Here's one for the paddle team.

Jigsaw teams

After all three teams are ready with their pieces, we"ll rearrange teams so all the pieces will be available to each group. I"ll work with these new teams to build a complete game of Pong.

Pong without any class

This morning, we"ll start working on a version of Pong that doesn"t use classes. You"ll need to share expertise between teams, so we"ll change up the groups to make jigsaw teams. If you"re in a group of three, it might work best to have one Navigator and two Drivers. Make sure both Drivers complete each step correctly.

Here are the jigsaw teams:

  • ["Dan", "Sidharth", "Mikel"]
  • ["Iman", "Max", "Lucas"]
  • ["Alex", "Samantha", "Ege"]
  • ["Omar", "Connor", "Elisa"]
  • ["Eave", "Liam", "Gabe"]
  • ["Prince", "Nik", "Henry"]

When setting up work for your team, it might be helpful to have the navigator read the directions, have the driver write the code, and have the third person look over the reference material to make sure you"re copying in the pieces you need to put the project together.

Wednesday, July 27

Learning required behaviors

We need to talk this morning about the requirements of a safe and productive environment, and how to develop the habits we need to maintain one. Topics for discussion:

  • Safety
  • Timely transitions
  • Encouraging each other
  • Awareness of people and surroundings outside the classroom

Yesterday's explorations

Here are a couple of things we worked on yesterday:

I noticed that Max and Liam created some cool CodeSkulptor effects. Connor got an image into his frame. Anybody have anything they"d like me to share on my site?

Adding Buttons

Starting with this example, we"ll add buttons to change a circle.

Dropbox

An invitation has been sent to your tjleone.com email address to join the Dropbox team for our class. If you create your own images, you can put them up on our Dropbox site and load them from there into CodeSkulptor.

Codecademy

For Codecademy, wherever you are now, you should skip ahead to UNIT 11: INTRODUCTION TO CLASSES. We will need to understand classes in order to assemble our final Pong game.

Preparation for Pong: Specialty Teams

Today we'll set up specialty teams for different parts of the Pong project. Specialists need a working program that involves their specialty and they need to be able to explain how it works. Teams are:

Paddle: Key Control Team

Your assignment is to make sure every member of your team has a CodeSkulptor program that allows the user to use arrow keys to move a rectangle on a canvas.

Team members: ["Daniel", "Alex", "Omar", "Eave", "Iman", "Prince"]

Ball: Motion and Bouncing Team

Your assignment is to make sure every member of your team has a CodeSkulptor program with a ball that moves around the canvas and bounces off the sides.

Team members: ["Samantha", "Sidharth", "Connor", "Liam", "Maxwell", "Nikita"]

Scoreboard: Text drawing, buttons, and timers

Your assignment is to make sure every member of your team has a CodeSkulptor program that displays a counter that is updated by a button.

Team members: ["Ege", "Lucas", "Elisa", "Mi"kel", "Edward", "Gabriel"]

I recommend that you pair off and do pair programming within your team, then compare notes when you"re done. When you have a single version of your team project that makes you happy, be sure to share it with all of your teammates. Each team will demo their work and explain their code later today.

To combine the ball, paddle, and scoreboard, we will put them into classes and combine the objects made from those classes. Everyone should get started on the Classes lesson in Codecademy the next time you get onto Codecademy.

Preparation for Pong: Specialty Teams

Today we'll set up specialty teams for different parts of the Pong project. Specialists need a working program that involves their specialty and they need to be able to explain how it works. Teams are:

Paddle Team

Your assignment is to make sure every member of your team has a CodeSkulptor program that allows the user to use arrow keys to move a rectangle on a canvas.

Team members: ["Daniel", "Alex", "Omar", "Eave", "Iman", "Prince"]

Start with the Ball position example.

  1. Remove conditions in the draw handler and the keydown handler that allow left and right movement, since our paddles will only go up or down.
  2. Make the ball continue moving after you press the key down. Use the velocity variable in the draw handler to do this.
  3. Add a keyup handler to set the velocity to 0 when a key is released. You will need to do this for each key that is pressed.
  4. Instead of drawing a circle, draw a rectangular polygon. What changes do you need to make to move the polygon and keep its shape?
  5. Add a test to the draw handler to keep the rectangle inside the canvas.
Ball Team

Your assignment is to make sure every member of your team has a CodeSkulptor program with a ball that moves around the canvas and bounces off the sides.

Team members: ["Samantha", "Sidharth", "Connor", "Liam", "Maxwell", "Nikita"]

Start with this project with scrolling text.

  1. Note how x, y, dx, and dy are used in this version.
  2. Make a circle move across the screen instead of text.
  3. Make the circle move in a random direction by setting dx to random.randrange(-10,10) and dy to random.randrange(-10,10). See Standard Modules->Random Module->random.randrange if you'd like to know more about randrange.
  4. When the circle hits a side of the frame, it make it bounce back. Consider this:
    • The center of the ball hits the left side of the frame when x == 0.
    • The center of the ball hits the right side of the frame when x == FRAME_WIDTH.
    • The center of the ball hits the top of the frame when y == 0.
    • The center of the ball hits the bottom of the frame when y == FRAME_HEIGHT.
    • You can reverse the x direction of the ball by setting dx to -dx.
    • You can reverse the y direction of the ball by setting dy to -dy.

The circle doesn't bounce until its center hits the edge of the frame. How could you take the radius of the ball into account to make a more realistic bounce?

Scoreboard Team

Your assignment is to make sure every member of your team has a CodeSkulptor program that displays a counter that is updated by pressing a button. You should be able to reset the counter to 0 by pushing a button.

Team members: ["Ege", "Lucas", "Elisa", "Mi"kel", "Edward", "Gabriel"]

Work in pairs. Start with the opening CodeSkulptor page.

  1. Change the variable name message to the word score everywhere in your code.
  2. Make sure the code still works.
  3. Instead of setting score to "Welcome", set it to 0.
  4. Try running your code. What happens?
  5. Use the str function to change your draw handler as shown below.

        def draw(canvas):
                canvas.draw_text(str(score), [50,112], 48, "Red")

Change your button handler to add points to the score:


                def click():
                        global score
                        score += 1

Test out your code. Does the score go up when you click?

Something else to try

Can you change your code so to use a timer to increase the score instead of the button handler?

Tuesday, July 26

Pair Programming

Pair Programming Partners for today

("Samantha", "Gabriel")
("Elisa", "Henry")
("Prince", "Lucas")
("Mi'kel", 'Sidharth")
("Eave", "Alex")
("Liam", "Iman")
("Daniel", "Maxwell")
("Connor", "Nikita")
("Ege", "Omar")

Pair programming Do's and Don"ts

Do

  1. Talk
  2. Listen
  3. Rotate Roles
  4. Be Patient
  5. Respect
  6. Take Breaks
  7. Prepare
  8. Clean
  9. Have Fun

Don"t

  1. Be Bossy
  2. Be Intimidated
  3. Be Quiet
  4. Suffer in Silence

Instructions to be read by Navigator

  1. Open up codeskulptor.org
  2. Run the program. Notice the location of the "Welcome" message.
  3. Close the frame.
  4. Find the list [50, 112] in the call to draw_text on line 19.
  5. The first element in the list is a 50. Change the 50 to 0 and run the program again. What happens to the location of the "Welcome" message? Try other values for the first element of the list. You can still see at least some of the message if you use values between -180 and 290. How do changes in the first element in list affect the position of the message? Try making changes to the second element in the list. When you"re done, set the values back to [50,112].
  6. On line 11, create a variable named position and intialize it to [50, 112]
  7. In the draw() event handler, replace [50, 112] with the variable position
  8. Test to make sure that the program still works.
  9. In the draw handler, add the line

    position[0] += 1

  10. Test the program again. What happens? Why?
  11. Starting at line 10, add these lines:

    WIDTH = 300

    HEIGHT = 200

    FONT_SIZE = 48

  12. Add this line to your draw handler after position[0] += 1:
    
            if position[0] >= WIDTH:
                    position[0] = 0
    
    
  13. Test the program. What happens? Why?
  14. We can make scrolling a little smoother if we start the text farther to the left. frame.get_canvas_textwidth(message, FONT_SIZE) will give us the length of the message string for the given FONT_SIZE. Try changing the if statement in your draw function to this:

    if position[0] >= WIDTH:

    
            position[0] = -frame.get_canvas_textwidth(message, FONT_SIZE)
    
    
  15. Test out your change. What happens? Why?
  16. Try initializing position to (50, 112) instead of [50, 112]. What happens? Why?
  17. Make your program work again.
  18. It would be nice if clicking the button could toggle the text back and forth between "Welcome!" and "Good job!"
  19. Try changing your click() function like so:
    def click():
        global message
        if message == "Welcome!":
            message = "Good job!"
        else:
            message = "Welcome!"
    

Conduct outside the classroom

Living and learning on a university campus requires maturity. Not every college student is up for it, and it can be a real challenge for students your age. I"ve seen some very mature behavior in the hallways and outside at recess. It's important that this same level of maturity be demonstrated everywhere on campus. If there are any questions about expectations that we cannot resolve with a particular student, we arrange for them to talk with Sherry for further clarification.

Quizlet Live Study Material

Today's Quizlet Live is based on the material on the More CodeSkulptor page. The complete set of terms is in the Quizlet below:

Individual Quizzes

After Quizlet Live, take these individual quizzes:

A couple of examples to experiment with

Here's an example we looked at this morning

Here's a program with two buttons and a bouncing ball. Try adding a button to change the radius.

More Pair Programming

You should try running your program at each step to see what happens. Is it what you expect?

  1. Open up this simplegui template.
  2. Change the comment at the top of your code page to say "# SimpleGUI draw program". You will use all the other comments exactly as they are. It is important that you place your code together with comments that describe it. Do not change or remove any other comments in this program.
  3. Open the CodeSkulptor Documentation by clicking the Docs button.
  4. Click on the Graphics tab.
  5. Select "SimpleGUI Module — Canvas".
  6. Click on the Operations link labeled "canvas.draw_polyline".
  7. Copy the definition of the draw handler to your CodeSkulptor program. It should appear under the comment "# Define event handler functions".
  8. Copy the statement that creates a frame to your CodeSkulptor program. It should appear under the comment "# Create a frame".
  9. Copy the statement that registers the draw handler. It should appear under the comment "# Register event handlers".
  10. Copy the code that starts the frame. It should appear under the comment "# Start frame and timers".
  11. Save your work by pressing the Save icon. You can bookmark your current page or copy and paste your code into a local file that you open in a text editor like NotePad++ (for Windows) or TextWrangler (for Mac). To be even safer, do both.

At this point, your code should look like this:

Run the program and make sure it works. Fix any bugs.

Navigator and driver should now switch roles. You can do this by sharing the link to your program, or just switch seats. Then complete the following:

  1. In the line frame = simplegui.create_frame("Testing", 100, 100), it's not clear what the number 100 is for, or why it appears two times. Let's add global variables to clarify. Put the following lines under the comment "# Define global variables (program state)":
    
    canvas_width = 100
    canvas_height = 100
    
  2. Run the program to make sure it still works.
  3. Now change the line that creates the frame by replacing the first 100 with canvas_width and the second 100 with canvas_height. That makes things a little clearer, doesn"t it?
  4. Now let's resize the canvas by changing the values of the global variables:
    
    canvas_width = 300
    canvas_height = 300
    
  5. Run the program to make sure that the canvas size changed. Make sure it changes, and make sure you can explain why it changed.
  6. Change the name of the frame from "Testing" to 'simple Drawing Program"

Make sure your program looks like this:

Navigator and driver should now switch roles again.

  1. Our goal to allow the user to draw a single poly line with mouse clicks. Let's get rid of one of the poly lines. Remove the code that draws the blue poly line.
  2. Our code should now draw a single red poly line with points in the list [(10, 20), (30, 20), (90, 70)]. To allow the user to draw poly lines interactively, we need to be able to add points to the list. Let's create a global variable for the points in the poly line. Below the definition of the global variable canvas_height, let's define a global variable called points:
    
    points = [(10, 20), (30, 20), (90, 70)]
    
  3. Now we can use the variable points in our call to draw_poly_line:
    
        canvas.draw_polyline(points, 12, "Red")
    
  4. Run your code to make sure it still works. If there are problems, fix them.

Here is what your code should look like now:

Navigator and driver switch roles one more time.

  1. We need to add a mouse click handler so the user can add points to the poly line by clicking the mouse on the canvas. Add this definition after the definition of draw_handler:
    
     def click(pos):
    	pass
    
  2. This function doesn"t do anything right now. We"ll fill it in a minute. First, we need to remember to register it. Add the following line after the line that registers the draw handler:
    
    frame.set_mouseclick_handler(click)
    
  3. Make sure your program still runs. Correct any errors.
  4. Now we can modify our click function so that it adds a point to our points list. Change it to look like this:
    
    def click(pos):
        points.append(pos)
    

Now your program should look like this:

When you"re finished, here are some other things to try:

  1. Change the starting value of your points variable.
  2. Create a button to change the color of the line you draw.
  3. Create a button to change the thickness of the line you draw.
  4. Try registering the draw handler as a drag handler
  5. Create a button clear the screen of any drawing.

Independent project

If you have time, you can start planning or coding a game of your own design. You can work on it alone or with a partner.

For a special challenge, try the Stopwatch: The Game

Monday, July 25

Quizlet Live

Today's Quizlet Live will be a special combination of the List Basics terms and the simplegui terms in the flash cards below. To prepare for today's Quizlet Live, work through the following two pages:

  1. List Basics
  2. Introduction to CodeSkulptor

Individual quizzes

There are two individual quizzes today. One on lists and one on simplegui.

Some important features of lists and tuples

We"ll use this CodeSkulptor program to practice using CodeSkulptor and go over some features of lists and tuples that will be important for the next exercise.

Globals

We"ll also go over a short example using a global variable

Preparation for CodeSkulptor Pair Programming

  • Open CodeSkulptor
  • When you run the Python code that comes up, a window appears that says, "Welcome!". Change the code so that a different message appears when you start up the program. Run the program to make sure your change worked.
  • When you run the program and click the button that says "Click me", the message changes to say "Good job!" Change the message from "Good job!" to something else. Run the program again to make sure your change worked.
  • The color "Red" is used to draw the text of the messages. Change the color of the text. You can use any of the HTML colors including "Aqua", "Black", "Blue", "Fuchsia", "Gray", "Green", "Lime", "Maroon", "Navy", "Olive", "Orange", "Purple", 'silver", "Teal", "White", or "Yellow".

After Preparation for Pair Programming

When you finish your preparation for pair programming, you can make other changes to the "Welcome!" CodeSkulptor program or work on Codecademy.

Friday, July 22

Plans for today

TJ will be in late this morning, around 10am. Hannah and Kristin will let you know what's happening until then.

The feedback I got from yesterday is that people liked the way we split into groups to work yesterday. At some point today, we should do that.

  • If you completed 6 or more CodingBat exercises yesterday, you can start working on String-1
  • If you worked outside the classroom yesterday and have finished Taking a Vacation, you can work on CodingBat or continue with Codecademy.
  • If you haven"t finished Functions yet, you can continue working on Codecademy with your group from yesterday.

Plans going forward

We"ll start doing Quizlets again next week, probably on Monday. Hannah came up with an idea that to make it go more smoothly. It looks like we"re on track to start game programming on Wednesday, July 27. Students will work on some combination of Codecademy and CodingBat until then.

Thursday, July 21

Codecademy goal for today

The Codecademy goal for today is to complete Unit 4 (Functions and Taking a Vacation).

Getting Our Bearings

We"ve covered a lot of material in the past few days. Instead of Quizlet today, we"re going to take some extra time to make sure we"re on track for game building next week. We will make sure we"ve gotten through the Codecademy we need, peek ahead at Codecademy lessons that will be useful later, or work with some of the material we"ve covered at a deeper level.

Codecademy and Games

Here are the Codecademy units that are most relevent to the game building we"ll be doing next week:

  • UNIT 1: PYTON SYNTAX
  • UNIT 2: STRINGS AND CONSOLE OUTPUT
  • UNIT 3: CONDITIONALS AND CONTROL FLOW
  • UNIT 4: FUNCTIONS
  • UNIT 7: LISTS AND FUNCTIONS
  • UNIT 8: LOOPS
  • UNIT 11: INTRODUCTION TO CLASSES

Last session, we got to Unit 11 on the second Wednesday of the session. For us, that would be Wednesday, July 27.

Wednesday, July 20

Campus policy

A short review of the policy on moving about campus.

Noise level

Some people need quieter environments than others. How can we accommodate this?

Codecademy goal for today

The goal for today is completion of Unit 3 (Conditionals and Flow Control and PygLatin). After you"ve finished Unit 3, you can continue with Codecademy or work on CodeCombat or Trinket.

Quizlet Live

Today's Quizlet Live will be based on the Quizlet on the Basic Operators page.

Here's your basic operators quiz

Tuesday, July 19

Quizlet Live Today

This afternoon, we"re going to have a Quizlet Live session. To prepare, work through the material on the Strings page of this site.

After Quizlet Live, take the quiz on the Strings page.

Getting Help vs. Cheating

Listen to a few sentences from these two speeches. Do you think this is a case of cheating?

What is cheating when it comes to writing code? Let's look at a page from MIT's site on academic integrity.

What about working together? Here's what MIT has to say about collaboration.

People have been using some great strategies for directing their own learning. Here are a few that I"ve seen:

  • Check the Python Discussion Forum.
  • Try Google. If you type in the word "Python" followed by your question, you'll often get just the answer you need.
  • Try experimenting. Sometimes you just need to try out different things in a Python console or script.
  • Ask a classmate. Someone else in class might have already come across the same problem and found a solution. Remember Linus's Law: "Given enough eyeballs, all bugs are shallow."--Eric Raymond, The Cathedral and the Bazaar.

If you've exhausted these possibilities, follow these steps to make the most efficient use of your guide's time:

  • Be ready to demonstrate the problem. Make sure the problem is still happening and you know how to make it happen. We can't help you fix a problem if you can't show it to us.
  • Be ready to explain what you've already done to try to solve the problem. That way, your instructor or TA can eliminate possibilities that need to be explored.

Don't suffer in silence! Everybody runs into trouble at some point. Remember Linus's Law: "given enough eyeballs, all bugs are shallow".

What if I don"t have anything to do?

If you"re not sure what you should be working on at any point in the day, here are some ideas:

  • Work on material from any of the course web pages. Be sure you"re familiar with the Strings material for this afternoon's Quizlet Live session.
  • Continue working on Codecademy
  • Play CodeCombat. If you choose to work on CodeCombat, you are expected to create an account to keep track of your progress.
  • Another thing you might like to try is trinket.io.

Monday, July 18

Welcome to Python Programming: From Games to Google!

We will spend the morning getting acquainted with each other and start exploring Python.

Logistics

  • Bathroom. Students need to be accompanied by an adult to the bathroom. Your class guides (TJ, Hannah, and Kristin) would like to be available as much as possible to help you with your work, so we'll schedule whole class bathroom breaks. One of us will accompany anyone any time they need to go, but try to go during scheduled breaks.
  • Outdoor breaks. Outdoor breaks will coincide with scheduled bathroom breaks. During that time, you will take your break with two of your class guides while the third watches the computers. You will either go to the bathroom or hang out in the area designated by your guides. You must be in sight of a guide at all times. You arrive in the classroom at 8:30am. We will take our morning outside break around 10:15. You"ll leave for lunch around 10:45am so you can be in the lunch room by 11:00am. We will also take an afternoon break outdoors around 2:00pm
  • Pomodoro breaks. We will also take short Pomodoro breaks so we have some kind of break every 25 minutes or so.
  • Food and Drink. Students can bring food and drink for break time. You can drink water in the classroom if it is in a water bottle.
  • Lunch. Students will leave for lunch with their TAs at 10:45am and return to the classroom around noon. This will give you time to walk to the cafeteria, eat, and then have some time to hang out or play outside.
  • Laptops cannot be left unattended. If your instructor and TAs are all leaving the room the same time as you, you'll have to take your laptop with you.
  • Noise Level. There are Northwestern students and faculty at work in this building. Noise level should be adjusted appropriately, especially in hallways.
  • Homework. CTD requires one hour of homework per day. We'll go over details this afternoon, when it will make more sense.
  • Headphones. If you have your own ear buds or headphones, you are welcome to bring them. Otherwise, headphones will be provided to you.

Getting to Know Each Other

Let's take some time this morning to learn a little about each other.

Fill out this survey so we have an idea the knowledge you have to share and what you want to learn.

How do you learn best?

Getting Started

You don't need to install Python to program in Python. Here's how to get started:

  • Log in to the gmail account that has been created for you. For most of you, your account will look like this:

        <your first name+first letter of your last name>@tjleone.com

    For example, if your name is Ezra Chintala, your email address is ezrac@tjleone.com.
  • Log in to Codecademy and start learning some python!
  • After you"ve done a few lessons, feel free to do some more, or go to the first page of this sites lessons, Explore Python to do some free exploration in Python.

Getting Help

We"ll discuss different ways to get help from your peers, class guides, and the internet. For now, a good Codecademy resource is the Python Discussion Forum. You can also raise your hand. Guides will try to work with students in an order and length of time that seems fair. We"ll work out a more formal way of spreading our expertise as the course goes forward.

Review of survey

Some time after our first break, we"ll go over the survey as a group

Ground Rules

Every work environment needs ground rules to keep things running smoothly. Here are some to get us started:

  • Treat others as you would like to be treated.
  • Respect other people and their property.
  • Laugh with anyone, but laugh at no one.
  • Be responsible for your own learning.
  • Do not disturb people who are working.

We'll discuss ground rules throughout the course, and add or change rules as needed.

What should be the consequences for breaking a rule? Here are three types I use:

  • You break it, you fix it.If something is taken, it should be returned. If something is broken, it should be replaced. If someone is physically or emotionally hurt, the damage should be repaired.
  • Temporary loss of privilege. If someone misuses bandwidth, they temporarily lose internet access.
  • Take a break. Sometimes students need some time away from a situation to clear their heads.

Any other ideas?

What should be the consequences for following the rules? We'll discuss this more in days to come.

Developing Talent

Since we're part of the Center for Talent Development, we need to discuss how to make this classroom a good place for developing talent. This is another topic we'll come back to throughout the course.

  • Everyone in this room has demonstrated the potential to develop cool software. Your job over the next three weeks is to develop that talent.
  • Each of you are already at different points in developing that potential. It will take more or less effort for you to develop your talent in different parts of the course. The thing to focus on is maintaining the effort to improve.
  • In order to create an atmosphere that supports continual development, part of your job is to encourage others.

Where Did Python Get Its Name?

Python was not named for the snake. It's inventor, Guido van Rossum, had a different Python in mind.

Python Setup

You can do most of the Python exercises through your browser, but at some point in the course, you'll probably want to run Python locally. Check out this web page to see if you already have Python installed and make sure you have the right version. If you need help with installation, Jimmy and I will be available, and there will probably be other students who can help you as well.

A local version of Python won't be necessary until some of the later activities. As long you have a working browser, you'll be able to complete all the activities for at least the first week.

Homework

For your homework, you can:

  • Work on material from any of the course web pages
  • Continue working on Codecademy
  • Play CodeCombat. If you choose to work on CodeCombat, you are expected to create an account to keep track of your progress.
  • Another thing you might like to try is trinket.io.

About the Center for Talent Development

Center for Talent Development (CTD), housed at Northwestern University's School of Education and Social Policy, is an accredited learning center and research facility that identifies, educates and supports gifted students and their families and serves as a leader in gifted education. Learn more about the Center for Talent Development.