Example #1
0
def sub_lista_prod_vend(pai,dados,total):
    cabecalhos = [u'Código',u'Descrição', u'Valor Unitário','Quantidade','Valor Total'] #TODO pesquisar nome previamente e colocar o nome do produto aqui, ao inves do codigo

    tabela = ttk.Treeview(columns=cabecalhos, show="headings")
    scroll_v = ttk.Scrollbar(orient="vertical", command=tabela.yview)
    scroll_h = ttk.Scrollbar(orient="horizontal", command=tabela.xview)
    tabela.configure(yscrollcommand=scroll_v.set, xscrollcommand=scroll_h.set)
    tabela.grid(column=0, row=3, columnspan=4, sticky='nsew', in_=pai)
    scroll_v.grid(column=4, row=3, sticky='nsw', in_=pai)
#    scroll_h.grid(column=0, row=4, sticky='ew', in_=pai)
    pai.grid_columnconfigure(4, weight=1)
    pai.grid_rowconfigure(4, weight=1)

    for col in cabecalhos:
        tabela.heading(col, text=col.title(),command=lambda c=col: view.sortby(tabela, c, 0))
            # adjust the column's width to the header string
        tabela.column(col,width=tkFont.Font().measure(col.title()))
    for item in dados:
        tabela.insert('', 'end', values=item)
        # adjust column's width if necessary to fit each value
        for ix, val in enumerate(item):
            col_w = tkFont.Font().measure(val)
            if tabela.column(cabecalhos[ix],width=None) < col_w :
                tabela.column(cabecalhos[ix], width=col_w)

    tabela.bind("<Double-Button-1>", lambda event: excluir_prod_vend(event,tabela,dados,pai,total))
Example #2
0
def tela_lista_prod(root, cabecalhos, dados):
    view.limpa_tela(root)

    frame_lista_vend = LabelFrame(root,
                                  text="Listagem Produtos",
                                  padx=5,
                                  pady=5)
    frame_lista_vend.grid(padx=10, pady=10)

    tabela = ttk.Treeview(columns=cabecalhos, show="headings")
    scroll_v = ttk.Scrollbar(orient="vertical", command=tabela.yview)
    scroll_h = ttk.Scrollbar(orient="horizontal", command=tabela.xview)
    tabela.configure(yscrollcommand=scroll_v.set, xscrollcommand=scroll_h.set)
    tabela.grid(column=0, row=0, sticky='nsew', in_=frame_lista_vend)
    scroll_v.grid(column=1, row=0, sticky='ns', in_=frame_lista_vend)
    scroll_h.grid(column=0, row=1, sticky='ew', in_=frame_lista_vend)
    frame_lista_vend.grid_columnconfigure(0, weight=1)
    frame_lista_vend.grid_rowconfigure(0, weight=1)

    for col in cabecalhos:
        tabela.heading(col,
                       text=col.title(),
                       command=lambda c=col: view.sortby(tabela, c, 0))
        # adjust the column's width to the header string
        tabela.column(col, width=tkFont.Font().measure(col.title()))
    for item in dados:
        tabela.insert('', 'end', values=item)
        # adjust column's width if necessary to fit each value
        for ix, val in enumerate(item):
            col_w = tkFont.Font().measure(val)
            if tabela.column(cabecalhos[ix], width=None) < col_w:
                tabela.column(cabecalhos[ix], width=col_w)

    tabela.bind("<Double-Button-1>",
                lambda event: mostra_dados_prod(event, tabela, root))
Example #3
0
def tela_lista_prod(root,cabecalhos, dados):
    view.limpa_tela(root)

    frame_lista_vend = LabelFrame(root, text="Listagem Produtos", padx=5, pady=5)
    frame_lista_vend.grid(padx=10, pady=10)    

    tabela = ttk.Treeview(columns=cabecalhos, show="headings")
    scroll_v = ttk.Scrollbar(orient="vertical", command=tabela.yview)
    scroll_h = ttk.Scrollbar(orient="horizontal", command=tabela.xview)
    tabela.configure(yscrollcommand=scroll_v.set, xscrollcommand=scroll_h.set)
    tabela.grid(column=0, row=0, sticky='nsew', in_=frame_lista_vend)
    scroll_v.grid(column=1, row=0, sticky='ns', in_=frame_lista_vend)
    scroll_h.grid(column=0, row=1, sticky='ew', in_=frame_lista_vend)
    frame_lista_vend.grid_columnconfigure(0, weight=1)
    frame_lista_vend.grid_rowconfigure(0, weight=1)
    
    for col in cabecalhos:
        tabela.heading(col, text=col.title(),command=lambda c=col: view.sortby(tabela, c, 0))
            # adjust the column's width to the header string
        tabela.column(col,width=tkFont.Font().measure(col.title()))
    for item in dados:
        tabela.insert('', 'end', values=item)
        # adjust column's width if necessary to fit each value
        for ix, val in enumerate(item):
            col_w = tkFont.Font().measure(val)
            if tabela.column(cabecalhos[ix],width=None) < col_w :
                tabela.column(cabecalhos[ix], width=col_w)

    tabela.bind("<Double-Button-1>", lambda event: mostra_dados_prod(event,tabela,root))