from tkinter import *
import random
root= Tk()
root.title("magic8ball")
root.geometry("350x300")
root.resizable(False,False)
root.configure(bg="#dcdcdc")
def jogo():
Eightball_resposta = [
"É certo.",
"Perspetivas boas",
"Pode confiar nele.",
"Pergunte mais tarde",
"Concentre-se e pergunte novamente",
"Responda nebuloso, tente novamente",
"A minha resposta é não.",
"As minhas fontes dizem que não."
]
text1['bg'] = "white"
a= random.choice(Eightball_resposta)
resposta1.set(a)
canvas = Canvas(width=300, height=300, bg='white')
canvas.pack()
canvas.create_oval(10, 10, 300, 300, width=2, fill='black')
resposta1 = StringVar()
text1 = Label(textvariable=resposta1,font=("Arial","10","bold"),bg="Black")
text1.place(relx=0.15,rely=0.5,relwidth=0.7)
but = Button( text="resposta", bd=2,bg='#107db2', fg='white',
font=('verdana', 10, 'bold'),command=jogo)
but.place(relx=0.8, rely=0.05, relwidth=0.2, relheight=0.1)
root.mainloop()