×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Quiz game in PySymbian

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Text replace - "Category:Python" to "Category:PySymbian")
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Fix ArticleMetaData and RevieweApproval)
Line 1: Line 1:
 
[[Category:S60]][[Category:PySymbian]][[Category:Games]][[Category:Code Snippet]]
 
[[Category:S60]][[Category:PySymbian]][[Category:Games]][[Category:Code Snippet]]
{{ArticleMetaData
+
{{ArticleMetaData <!-- v1.1 -->
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
Line 7: Line 7:
 
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->  
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
|signing=<!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
+
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
|capabilities=<!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
+
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 
|id= <!-- Article Id (Knowledge base articles only) -->
 
|id= <!-- Article Id (Knowledge base articles only) -->
|language=<!-- Language category code for non-English topics - e.g. Lang-Chinese -->
+
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
|review-by=<!-- After re-review: [[User:username]] -->
+
|translated-by= <!-- [[User:XXXX]] -->
|review-timestamp=<!-- After re-review: YYYYMMDD -->
+
|translated-from-title= <!-- Title only -->
|update-by=<!-- After significant update: [[User:username]]-->
+
|translated-from-id= <!-- Id of translated revision -->
|update-timestamp=<!-- After significant update: YYYYMMDD -->
+
|review-by= <!-- After re-review: [[User:username]] -->
|creationdate=20090220
+
|review-timestamp= <!-- After re-review: YYYYMMDD -->
|author=[[User:Jimgilmour1]]
+
|update-by= <!-- After significant update: [[User:username]]-->
}}{{ReviewerApproved|timestamp=20090924}}
+
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20090220
 +
|author= [[User:Jimgilmour1]]
 +
}}
  
 
==Overview==
 
==Overview==

Revision as of 07:18, 9 February 2012

Article Metadata
Article
Created: jimgilmour1 (20 Feb 2009)
Last edited: hamishwillee (09 Feb 2012)

Overview

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.This is the game which gives you idea to create question and answer ni python.

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 Patil",op1),(u"Sonia Gandhi",op2),(u"Indira Gandhi",op2),(u"Dr. 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.

97 page views in the last 30 days.
×