How to make a quiz in python tkinter

from tkinter import *

from tkinter import messagebox as mb

import json

class Quiz:

    def __init__(self):










    def display_result(self):

        wrong_count = self.data_size - self.correct

        correct = f"Correct: {self.correct}"

        wrong = f"Wrong: {wrong_count}"

        score = int(self.correct / self.data_size * 100)

        result = f"Score: {score}%"

        mb.showinfo("Result", f"{result}\n{correct}\n{wrong}")

    def check_ans(self, q_no):

        if self.opt_selected.get() == answer[q_no]:

            return True

    def next_btn(self):

        if self.check_ans(self.q_no):

            self.correct += 1

        self.q_no += 1

        if self.q_no==self.data_size:






    def buttons(self):

        next_button = Button(gui, text="Next",command=self.next_btn,


        quit_button = Button(gui, text="Quit", command=gui.destroy,

        width=5,bg="black", fg="white",font=("ariel",16," bold")),y=50)

    def display_options(self):



        for option in options[self.q_no]:



    def display_question(self):

        q_no = Label(gui, text=question[self.q_no], width=60,

        font=( 'ariel' ,16, 'bold' ), anchor= 'w' ), y=100)

    def display_title(self):

        title = Label(gui, text="GeeksforGeeks QUIZ",

        width=50, bg="green",fg="white", font=("ariel", 20, "bold")), y=2)

    def radio_buttons(self):

        q_list = []

        y_pos = 150

        while len(q_list) < 4:

            radio_btn = Radiobutton(gui,text=" ",variable=self.opt_selected,

            value = len(q_list)+1,font = ("ariel",14))


   = 100, y = y_pos)

            y_pos += 40

        return q_list

gui = Tk()


gui.title("GeeksforGeeks Quiz")

with open('data.json') as f:

    data = json.load(f)

question = (data['question'])

options = (data['options'])

answer = (data[ 'answer'])

quiz = Quiz()


How do you make a Python GUI quiz?

Importing the module: tkinter and json..
Create the main window (container) of the app..
Add widgets to display data..
Add the functionalities to the button..
Using the data in the Quiz..

Can you make a game with Tkinter?

TKinter is widely used for developing GUI applications. Along with applications, we can also use Tkinter GUI to develop games.

How do you make a quiz app?

7 steps to build a quiz game for Android.
Open the Quiz App Template. Click on "Create App Now" button or visit, open the "Quiz" app template..
Set Up Categories. ... .
Add Questions & Answers. ... .
Customize App Design. ... .
Name your App. ... .
Submit an Icon. ... .
Publish App on Google Play​.