0

Okay, so I'm writing this trivia game with graphics and whatnot. I'm not that far along, but every time I try to just have one question come up, all of them do. It's frustrating because I've looked at a ton of examples and can't see where I'm going wrong.

Here is what I've been doing:
(for the record, questions.txt has 90 lines, with every 10th line being a question)

from graphics import *
import random

def trivia():
    file = open("questions.txt", "r")
    trivia = file.readlines()
    track = 0


    win = GraphWin("screen", 600, 500)
    win.setBackground("white")

    fist = Image(Point(535, 440), "score.gif")

    trackRect = Rectangle(Point(535, 435), Point(600, 500))
    trackRect.setOutline("black")
    trackRect.setFill("white")

    welcome = Text(Point(300, 250), "Welcome.  Click to Start")
    welcome.setFace("times roman")
    welcome.setSize(36)
    welcome.setOutline("black")
    welcome.setFill("black")
    welcome.draw(win)

    win.getMouse()
    welcome.undraw()

    while track < 11:
        numbforq = random.randrange(1, 91, 10)
        q = trivia[numbforq]

        qtext = Text(Point(300, 500), q)
        qtext.draw(win)
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pyTony
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.