×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Quiz game in PySymbian

From Nokia Developer Wiki
Jump to: navigation, search
jimgilmour1 (Talk | contribs)
croozeus (Talk | contribs)

Revision as of 21:51, 20 February 2009

File:More work needed.gif


Moderator note:-

The previous name ""Slum dog millionaire game in python for S60" violates Copyright and has been changed to name which is believed not to be Copyright"

This was written by another author and still needs update

S60 Mumbai Millionaire game in python for S60

I have created game in python which ask us one question. And question contains four answers we have to select the correct and if we give wrong answer then the message is displayed that your answer is wrong and if we give correct and then message is displayed that your answer is correct. Code is given below it is in python and it will work in all S60 phones.

Code snippet:

import  appuifw, e32
 
 
app_lock = e32.Ao_lock()
 
#Define the exit function
 
def quit():
app_lock.signal()
appuifw.app.exit_key_handler = quit
 
#given the title name rahul
appuifw.app.title=u'game'
 
#Create an instance of Text and set it as the application's body
 
t = appuifw.Text()
appuifw.app.body = t
 
#Set the color of the text
t.color = 0xFFF00F
 
#Set the font by name, size and flags
t.font = (u"LatinPlain12", 20, None)
 
 
#we have to write question as text
t.add(u"que.1 who is the president of india ? for answer click on options")
 
def op1(): #defining the callback functions
appuifw.note(u"your answer is correct","info")
 
def op2():
appuifw.note(u"your answer is wrong","info")
 
 
 
def quit(): #defining the exit function
app_lock.signal()
 
#making the actual application menu
appuifw.app.menu = [(u"pratibha",op1),(u"sonia",op2),(u"indira",op2),(u"abdul kalam",op2)]
 
 
#Wait for the user to request the exit
app_lock.wait()

To do: I have created only one question and four answer for the testing. Here you can create a chain of question and answer for complete game. And you can make this game more attractive by some modification. So it will look attractive.

102 page views in the last 30 days.
×