Tkinter==>Label/Msg present only 1 item in the list. How to resolve?

Asked

Viewed 71 times

0

Well, the goal is to make, on the same label or msg, all the items on the list appear. I’m not very experienced at Tkinter, so I don’t know if there’s a limit to that. Follow part of the code below.

prod=['Exemplo-10.00','Exemplo2-20.00','Exemplo3-30.00']
##
def create_window():
    top = tk.Toplevel()
    top.title('Tabela de Preços')
    h=Message(top, width=310 , text='' )
    h.place(x=50,y=50)
    h.config(font=('Courier', 20))
    h.pack()
    def listagem():
        for i in prod:
            yo=int(i.find('-'))
            h['text']=str(i[0:yo]+'.......'+str(i[yo:-1]))
    bto=Button(top, width=22 , height=2 ,text='Clique para mostrar a tabela', command=listagem)
    bto.place(x=0,y=5)
    bto.pack()
    top.geometry('400x600+300+60')
  • It is not easier to use listview in your case?

  • Yes, I didn’t know and I did some research. Thank you!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.