0% found this document useful (0 votes)
4 views12 pages

Trivia Quiz App Development Guide

The document outlines the development of a Trivia Quiz Application that uses the Open Trivia Database API to provide users with engaging trivia questions. It details the project plan, including estimated time for planning, design, development, testing, and documentation, totaling approximately 21 hours and 45 minutes. Additionally, it includes technical descriptions, testing results, and reflections on potential improvements for the application.

Uploaded by

alonaby374
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views12 pages

Trivia Quiz App Development Guide

The document outlines the development of a Trivia Quiz Application that uses the Open Trivia Database API to provide users with engaging trivia questions. It details the project plan, including estimated time for planning, design, development, testing, and documentation, totaling approximately 21 hours and 45 minutes. Additionally, it includes technical descriptions, testing results, and reflections on potential improvements for the application.

Uploaded by

alonaby374
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

The Development Document

GitHub Repository Link: [Link]

Google Drive Link: [Link]


r8g3VaghMepsFMpMcqwks?usp=share_link

YouTube Link for a Walkthrough of the program: [Link]


YouTube Link for Technical Description: [Link]

Name : Malaika Noor


Student ID: 577875

 Abstract:

The Trivia Quiz Application is a data-driven application designed to give users an engaging
trivia quiz experience. The application fetches trivia questions from the Open Trivia Database
API
([Link]
amount=40&category=9&difficulty=medium&type=multiple&encode=url3986), which
offers a wide range of trivia questions across various categories and difficulty levels. The
application is built using Python's Tkinter library for the graphical user interface (GUI) and
the Requests library for making HTTP requests to the API.
My application allows users to answer multiple-choice questions, providing immediate
feedback on their answers. The questions are randomized to ensure a unique experience each
time the quiz is [Link] application utilizes the following additional libraries:
• Tkinter: pip install tk
• Requests: pip install requests
Github Link: [Link]

● Project Plan

Planning (Estimated Time: 2 hours)
• Task 1.1: Research trivia APIs and select Open Trivia Database (1 hour)
• Task 1.2: Define application requirements and features (1 hour)
Design (Estimated Time: 1 hour 45 Min)
• Task 2.1: Create wireframes for the GUI (30 Min)
• Task 2.2: Develop a flowchart for the application logic (45 Min)
• Task 2.3: Design a UML Data Structure Diagram (30 Min)
Development (Estimated Time: 9 hours)
• Task 3.1: Set up the project environment and install necessary libraries (1 hour)
• Task 3.2: Implement the API integration to fetch trivia questions (3 hours)
• Task 3.3: Develop the GUI using Tkinter (1 hour)
• Task 3.4: Implement the quiz logic and answer checking (2 hours)
• Task 3.5: Add error handling and user feedback mechanisms (2 hours)
Testing (Estimated Time: 4 hours)
• Task 4.1: Create a test plan with test cases (2 hours)
• Task 4.2: Conduct unit testing for individual components (2 hours)
Documentation and Reflection (Estimated Time: 5 hours)
• Task 5.1: Write the development document (3 hours)
• Task 5.2: Create a video walkthrough of the application (2 hours)
Total Estimated Time: 21 hours 45 Min

● Evidence of design:
Figure 1 Flowchart.
UML Data Structure

TriviaQuestion
- question: String
- correct_answer: String
- all_answers: List<String>
+ get_question()
+ get_correct_answer()
+ get_all_answers()

Pseudo-Code

FUNCTION fetch_trivia_questions():
SET url to Open Trivia Database API
SEND GET request to url
PARSE response to JSON
FOR each item in results:
UNQUOTE question and answers
RANDOMIZE answers
APPEND question, correct answer, and all answers to questions list
RETURN questions list

FUNCTION display_question():
IF current_question_index < length of trivia_questions:
GET current question and answers
UPDATE GUI with question and answers
ELSE:
DISPLAY "Quiz Complete!"

FUNCTION check_answer(selected, correct):


IF selected == correct:
DISPLAY "Correct!"
ELSE:
DISPLAY "Wrong! The correct answer is: correct"
CALL display_question()
● Technical Description & Walkthrough

● YouTube Link for a Walkthrough of the program: [Link]


● YouTube Link for Technical Description: [Link]

● Testing:
Testing Table
Test
Case Test Case Actual
ID Description Input/Action Expected Result Result Status

Fetch trivia Application fetches


TC- questions from Launch the 40 trivia questions
001 API application successfully Pass Pass

First question is
TC- Display the first displayed with
002 trivia question Start the quiz answer options Pass Pass

TC- Randomize Display question Answer options are


003 answer options with answers randomized Pass Pass

TC- Check correct Select the correct Display "Correct!"


004 answer answer message Pass Pass

Display "Wrong!
TC- Check incorrect Select an The correct answer
005 answer incorrect answer is: [correct answer]" Pass Pass

Navigate to the
TC- next question Answer a Next question is
006 after answering question displayed Pass Pass

Display "Quiz
TC- Complete the Answer all Complete! Thank
007 quiz questions you for playing." Pass Pass
Test
Case Test Case Actual
ID Description Input/Action Expected Result Result Status

Simulate API Display an error


failure (e.g., message indicating
TC- Handle API disconnect failure to fetch
008 failure gracefully internet) questions Pass Pass

Ensure GUI Resize the GUI elements


TC- elements are application adjust accordingly
009 responsive window without overlap Pass Pass

Validate user Feedback is


TC- feedback for displayed correctly
010 answers Answer questions for each answer Pass Pass
● Critical Reflection:

● It's definitely one of the very best ways how Python and Tkinter can be used to make
a really fascinating and interactive experience for users, and by integrating it with
Open Trivia Database API, interesting varieties of trivia questions can be given to a
user. Other features include the fact that it can give instant feedback right after
answering questions so the user won't get bored, answer choices are randomly
shuffled so that every quiz will be fresh and users can't just memorize answers.
Moreover, API failure error handling is also implemented in order to make this
application more robust. However, there are some points for further [Link] is
also possible to personalize the user interface in several ways, aesthetically enhancing
its appearance and layout. Other nice-to-have personalizations include selecting
categories or opting for the number of questions. Introducing a timer, leader
scoreboard, or keeping scores might make the game more fun and engaging. Further
areas in which I want to continue the learning process: studying Tkinter themes and
further possibilities regarding styling, connecting a database where the progress is
followed and scores accumulated, and of course finding out about best practices for
the publication of programs.
● Appendix:

● import tkinter as tk
● import requests
● import random
● import [Link]

● # Fetch trivia questions from the API
● def fetch_trivia_questions():
● url = '[Link]
amount=40&category=9&difficulty=medium&type=multiple&encode=url3986'
● response = [Link](url)
● data = [Link]()

● questions = []
● for item in data['results']:
● question = [Link](item['question'])
● correct_answer = [Link](item['correct_answer'])
● incorrect_answers = [[Link](ans) for ans in item['incorrect_answers']]
● all_answers = incorrect_answers + [correct_answer]
● [Link](all_answers)
● [Link]((question, correct_answer, all_answers))
● return questions

● # Function to display a question
● def display_question():
● global current_question_index
● if current_question_index < len(trivia_questions):
● question, correct_answer, all_answers = trivia_questions[current_question_index]
● current_question_index += 1

● # Display question and answers
● question_label.config(text=question)
● answer_button1.config(text=all_answers[0], command=lambda:
check_answer(all_answers[0], correct_answer))
● answer_button2.config(text=all_answers[1], command=lambda:
check_answer(all_answers[1], correct_answer))
● answer_button3.config(text=all_answers[2], command=lambda:
check_answer(all_answers[2], correct_answer))
● answer_button4.config(text=all_answers[3], command=lambda:
check_answer(all_answers[3], correct_answer))
● else:
● # No more questions
● question_label.config(text="Quiz Complete! Thank you for playing.")
● answer_button1.pack_forget()
● answer_button2.pack_forget()
● answer_button3.pack_forget()
● answer_button4.pack_forget()

● # Function to check if the selected answer is correct
● def check_answer(selected, correct):
● if selected == correct:
● result_label.config(text="Correct!", fg='green')
● else:
● result_label.config(text=f"Wrong! The correct answer is: {correct}", fg='red')
● display_question() # Show the next question

● # Fetch all questions from the API
● trivia_questions = fetch_trivia_questions()
● current_question_index = 0

● # Create the main window
● root = [Link]()
● [Link]('Trivia Quiz App')

● # Create GUI elements
● question_label = [Link](root, text="Question will appear here", wraplength=400)
● question_label.pack(pady=20)

● answer_button1 = [Link](root, text="Answer 1", width=40, height=2)
● answer_button1.pack(pady=5)

● answer_button2 = [Link](root, text="Answer 2", width=40, height=2)
● answer_button2.pack(pady=5)

● answer_button3 = [Link](root, text="Answer 3", width=40, height=2)
● answer_button3.pack(pady=5)

● answer_button4 = [Link](root, text="Answer 4", width=40, height=2)
● answer_button4.pack(pady=5)

● result_label = [Link](root, text="", font=('Helvetica', 14))
● result_label.pack(pady=20)

● # Start the quiz
● display_question()

● # Start the Tkinter event loop
● [Link]()

You might also like