You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm fighting against the following problem for several days:
I coded a simple customtkinter GUI to work with a raspberry.
I added a pandas table in a frame, however i would like that such table is real time updated every time the dataframe changes (or when a function is called from outside the frame object)
how can I add a function that when i press "save" (see the image) the dataframe of the table is refreshed?
(I take out all code that is not useful for the issue)
class right_frame(ctk.CTkFrame):
def __init__(self, master):
super().__init__(master)
df = pd.read_csv("storico_produzione/31_2023.csv")
self.table = Table(self, dataframe= df, showtoolbar=False, showstatusbar=True)
options = {'align': 'w'}
config.apply_options(options, self.table)
self.table.editable = True
self.table.show()
def update(self):
#here the function should update the dataframe
class buttons_frame(ctk.CTkFrame):
def __init__(self, master):
super().__init__(master)
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(0, weight=1, minsize = appWidth/4)
self.grid_columnconfigure(1, weight=1, minsize = appWidth/4)
self.grid_columnconfigure(2, weight=1, minsize = appWidth/2)
def save_function():
right_frame(master).update()
self.save_button = ctk.CTkButton(self,text="Save", state="disabled", hover_color = "grey", fg_color="dark grey", command = save_function)
self.save_button.grid(row=0, column=2, sticky="w",padx=10)
# App Class
class App(ctk.CTk):
# The layout of the window will be written
# in the init function itself
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Sets the title of the window to "App"
self.title("GUI Application")
# Sets the dimensions of the window to 600x700
self.geometry(f"{appWidth}x{appHeight}")
self.grid_columnconfigure(0, weight=1, minsize = appWidth/2)
self.grid_columnconfigure(1, weight=1, minsize = appWidth/2)
self.grid_rowconfigure(0, weight=5, minsize = appHeight/6*5)
self.grid_rowconfigure(1, weight=1, minsize = appHeight/6)
#recall the right Frame
self.MyRight_frame = right_frame(self)
self.MyRight_frame.grid(row=0, column=1, padx=1, pady=0,sticky="snew")
#self.MyRight_frame.configure(width=appWidth/2, height= appHeight/6*5)
#recall the button Frame
self.MyButtomLeft_frame = buttons_frame(self)
self.MyButtomLeft_frame.grid(row=1, column= 0, columnspan = 2, padx=1, pady=1, sticky = "snew")
if __name__ == "__main__":
app = App()
# Used to run the application
app.mainloop()
The text was updated successfully, but these errors were encountered:
Hi, I'm fighting against the following problem for several days:
I coded a simple customtkinter GUI to work with a raspberry.
I added a pandas table in a frame, however i would like that such table is real time updated every time the dataframe changes (or when a function is called from outside the frame object)
how can I add a function that when i press "save" (see the image) the dataframe of the table is refreshed?
(I take out all code that is not useful for the issue)
The text was updated successfully, but these errors were encountered: