User:Eleanorg/2.2/yes

From XPUB & Lens-Based wiki
< User:Eleanorg
Revision as of 22:10, 25 January 2013 by Eleanorg (talk | contribs) (Created page with "The word yes is printed to screen. User votes 'yes', 'no', or 'maybe'. For each 'maybe' the word gets x amount bigger. For each 'yes' it gets twice that amount bigger. Each no...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The word yes is printed to screen. User votes 'yes', 'no', or 'maybe'. For each 'maybe' the word gets x amount bigger. For each 'yes' it gets twice that amount bigger. Each no is counted as zero and does not affect the size.

Code

Make db

Make a db to count the votes. Run once.

#!/usr/bin/python
#-*- coding:utf-8 -*-

import pymongo
from pymongo import Connection
 
connection = Connection()
myDB = connection['yes1']
collection = myDB.collection 

# create db entry to track votes, starting at zero.
entry = {'title': 'yesVotes', 'tally': 0 }
collection.insert(entry)

Voting interface