'i'm trying to make a number guesser so when the button is pressed it should begin the game, the button works but the game will not begin

it should make a windows and create a button which it does but when i click it it does not begin the game my code is:

from tkinter import *

a = False
import random
def start():
    a = True

window = Tk()
window.geometry("500x500")
btn = Button(window, text="Want to play a game?", bd = "5", command = start )
btn.pack(side = 'top')
window.mainloop()

if a == True:
    s = random.randint(1,4)
    t = int(input("Pick a number 1-4: "))
    if t != s:
        print("You lose!")
    else:
        print("You win!")


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source