1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Função sendo executada automaticamente

Discussão em 'Python' iniciado por Stack, Outubro 7, 2024 às 12:52.

  1. Stack

    Stack Membro Participativo

    Estou criando um app no CustomTkinter, a ideia e ter uma opção par ao usuário indicar aonde está os dados a serem processados e um botão para indicar aonde os dados processados serão salvos, porém ao executar o script a função de busca do diretório é executada automaticamente e quando eu tento alterar dá o seguinte erro: TypeError: 'str' object is not callable. Abaixo segue o script

    import customtkinter as ct
    from tkinter import ttk
    from CTkMenuBar import *
    from datetime import datetime
    import pandas as pd
    import tkinter as tk
    from tkinter import filedialog

    class App(ct.CTk):
    def __init__(self):
    super().__init__()
    self.title("SADJud")
    w = 760
    h = 520
    ws = self.winfo_screenwidth()
    hs = self.winfo_screenheight()
    x = (ws/2)-(w/2)
    y = (hs/2)-(h/2)
    self.geometry('%dx%d+%d+%d' % (w, h, x, y))
    self.lblOrigem = tk.Label(self, bg = "white", width=70, bd = 4, relief="sunken", text="Clique no botão")
    self.lblOrigem.place(x = 200, y = 101)
    self.origemArqs = ct.CTkButton(self,
    text="Origem dos Arquivos", command=self.caminhoArqs(self.lblOrigem))
    self.origemArqs.place(x = 40, y = 100)


    self.lblDestino = tk.Label(self, bg = "white", width=70, bd = 4, relief="sunken")
    self.lblDestino.place(x = 200, y = 301)
    self.destArqs = ct.CTkButton(self,
    text="Destino dos Arquivos", command=self.caminhoArqs(self.lblDestino))
    self.destArqs.place(x = 40, y = 300)

    self.processar = ct.CTkButton(self,
    text="Processar Arquivos")
    self.processar.place(x = 300, y = 400)

    def caminhoArqs(self, label):
    directory = filedialog.askdirectory()
    label.config(text = directory)
    return directory
    app = App()
    app.mainloop()

    Continue reading...

Compartilhe esta Página