Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pandas function requirements #253

Open
2805951124 opened this issue Mar 29, 2024 · 1 comment
Open

Pandas function requirements #253

2805951124 opened this issue Mar 29, 2024 · 1 comment

Comments

@2805951124
Copy link

When entering data, you can only save the edited data by entering, and you cannot save the data and display it in the table by removing the focus.

def on_leave(event, table, row, col, previous_value, new_value, current_input):
table.model.df.iat[row, col] = new_value
print("Previous cell value:", previous_value)
print("New cell value:", new_value)
print("Current input:", current_input)

def main_win():
userData = {'Key Type': ['data'],
'Key Data': [''] }

root = tk.Tk()
root.minsize(560, 650)
root.title("Generate Hex")

top_frame = tk.Frame(root)
top_frame.pack(fill="both", expand=True)

table = Table(top_frame, dataframe=pd.DataFrame(userData), showstatusbar=False)
table.show()

table.resizeColumn(1, width=380)

def leave_event(event, table=table):
    row, col = table.getSelectedRow(), table.getSelectedColumn()
    new_value = table.model.df.iat[row, col]
    current_input = table.model.df.iat[row, col]  
    previous_value = table.model.df.iat[row, col]  
    on_leave(event, table, row, col, previous_value, new_value, current_input)

table.bind('<FocusOut>', leave_event)

root.mainloop()

if name == "main":
main_win()

@dmnfarrell
Copy link
Owner

changing this would require adding an 'edit' mode as the current behaviour is what people are used to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants