2
I’m trying to build a simple raffle script using the Tkinter library.
from tkinter import *
def sorteio():
from random import choice
nomes = (ed1.get)
splitn = nomes.split(" ")
sort = choice(splitn)
lb3['text'] = '\033[34mO nome sorteado foi \033[31m{}'.format(sort.title())
janela = Tk()
ed1 = Entry(janela, width=50, bg='green')
bt1 = Button(janela, width=7, bg='green', command=sorteio, text='Sortear')
lb1 = Label(janela, bg='green', text='Digite no campo a baixo\nos nomes a serem sorteados')
lb2 = Label(janela, bg='green', text='Nomes:')
lb3 = Label(janela, bg='green', text='')
ed1.grid(row=2, column=2)
bt1.grid(row=3, column=2)
lb1.grid(row=1, column=2)
lb2.grid(row=2, column=1)
lb3.grid(row=4, column=2)
janela['bg'] = 'green'
janela.geometry('500x500+500+500')
janela.mainloop()
As you can see, the split function did not work, and I do not know how else I can convert the str into list, if anyone knows how to help me I would be very grateful.
I’m new to programming so I don’t really know what the name of each thing is, so I’m sorry if I missed something there...
What error appears in?
– FourZeroFive