Tkinter Tutorial 5

Developing something useful from this and adding new components

A few months ago Tom Brough from the Linux user group, ( if you attend Pi jams in Exeter and Paignton you will know Tom from his excellent demonstrations of marco and bob the robot,  more recently a frapper bot and at the last jam a wii remote scratch game. )

Wrote a magic 8 ball game in python.  This is below

#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
#!/usr/bin/env python
 
import random
 
RESPONSES = ["It is certain",
             "It is decidedly so",
             "Without a doubt", (I have shortened this for the purpose of this tutorial)
             "Yes definitely",
             "You may rely on it",
             "As I see it yes",
             "Most likely",
             "Outlook good",
             "Yes",
             "Signs point to yes",
             "Reply hazy try again",
             "Ask again later",
             "Better not tell you now",
             "Cannot predict now",
             "Concentrate and ask again",
             "Don't count on it",
             "My reply is no",
             "My sources say no",
             "Outlook not so good",
             "Very doubtful"] 
 
while(True):
    raw_input("Enter your question: ")
    print random.choice(RESPONSES)

What we will look at in the next tutorial is taking this and creating a GUi version.