-
-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy path1-function.py
More file actions
33 lines (23 loc) · 742 Bytes
/
Copy path1-function.py
File metadata and controls
33 lines (23 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
import pandas as pd
import tkinter as tk
# --- functions ---
def change(event, row, col):
print(event.widget.get())
df.iloc[row,col] = event.widget.get()
print(df)
# --- main --
df = pd.DataFrame([[1,2,3], [5,6,7], [101,102,103]])
root = tk.Tk()
rows, cols = df.shape
for r in range(rows):
for c in range(cols):
e = tk.Entry(root)
e.insert(0, df.iloc[r,c])
e.grid(row=r, column=c)
# ENTER
#e.bind('<Return>', lambda event, y=r, x=c: change(event, y,x))
# ENTER on keypad
#e.bind('<Return>', lambda event, y=r, x=c: change(event, y,x))
e.bind('<KeyRelease>', lambda event, y=r, x=c: change(event, y,x))
root.mainloop()