Help with python Tkinter

Asked

Viewed 49 times

-1

Good morning, There’s an extra column, but I can’t figure out where the mistake is. follows the code:

from tkinter import*
from tkinter import messagebox
from tkinter import ttk
class arquivo:
     def __init__(self,master=None):
         self.widget1=Tk()
         self.widget1.title("Programa Transanches")
         self.tabela=ttk.Treeview(self.widget1,selectmode="browse",column=("column1","column2","column3","column4","column5"))
         self.tabela.column("column1", width=200, minwidth=50, stretch=NO)
         self.tabela.heading("#1", text="Numero Carga")
         self.tabela.grid(row=1, column=0)
         self.tabela.column("column2", width=200, minwidth=50, stretch=NO)
         self.tabela.heading("#2", text="Cidades")
         self.tabela.grid(row=1, column=1)
         self.tabela.column("column3", width=200, minwidth=50, stretch=NO)
         self.tabela.heading("#3", text="Estados")
         self.tabela.grid(row=1, column=2)
         self.tabela.column("column4", width=200, minwidth=50, stretch=NO)
         self.tabela.heading("#4", text="Total de Peso")
         self.tabela.grid(row=1, column=3)
         self.tabela.column("column5", width=200, minwidth=50, stretch=NO)
         self.tabela.heading("#5", text="Total de Volumes")
         self.tabela.grid(row=1, column=4)
         self.widget1.mainloop()

1 answer

-1

Good afternoon, the error that occurs is that nothing appears right? Here is the pq: you have to instantiate the class because it was built but it was not instantiated, another issue just a good practice advice name the classes with LetraMausculaNasPrimeirasPalavras Okay? Follow the code:

from tkinter import*
from tkinter import messagebox
from tkinter import ttk
class Arquivo:
     def __init__(self,master=None):
         self.widget1=Tk()
         self.widget1.title("Programa Transanches")
         self.tabela=ttk.Treeview(self.widget1,selectmode="browse",column=("column1","column2","column3","column4","column5"))
         self.tabela.column("column1", width=200, minwidth=50, stretch=NO)
         self.tabela.heading("#1", text="Numero Carga")
         self.tabela.grid(row=1, column=0)
         self.tabela.column("column2", width=200, minwidth=50, stretch=NO)
         self.tabela.heading("#2", text="Cidades")
         self.tabela.grid(row=1, column=1)
         self.tabela.column("column3", width=200, minwidth=50, stretch=NO)
         self.tabela.heading("#3", text="Estados")
         self.tabela.grid(row=1, column=2)
         self.tabela.column("column4", width=200, minwidth=50, stretch=NO)
         self.tabela.heading("#4", text="Total de Peso")
         self.tabela.grid(row=1, column=3)
         self.tabela.column("column5", width=200, minwidth=50, stretch=NO)
         self.tabela.heading("#5", text="Total de Volumes")
         self.tabela.grid(row=1, column=4)
         self.widget1.mainloop()


if __name__ == '__main__':
    Arquivo()

  • 1

    Thank you, darling by force, find out what was missing, is missing a header

Browser other questions tagged

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