| 1 |
|
| 2 |
import qutesheet as q |
| 3 |
from Tkinter import * |
| 4 |
|
| 5 |
|
| 6 |
cells = q.cells_selection_by_row() |
| 7 |
new_data = [] |
| 8 |
|
| 9 |
root = Tk() |
| 10 |
|
| 11 |
def fill(): |
| 12 |
global cells, root |
| 13 |
for c in cells: |
| 14 |
new_data.append(text_var.get()) |
| 15 |
|
| 16 |
q.set_cells_by_row(new_data) |
| 17 |
|
| 18 |
root.destroy() |
| 19 |
|
| 20 |
root = Tk() |
| 21 |
root.title("Fill cells with text") |
| 22 |
l = Label(root, text="Text") |
| 23 |
l.grid(row=0) |
| 24 |
text_var = StringVar(root) |
| 25 |
textentry = Entry(root, textvariable=text_var) |
| 26 |
textentry.grid(row=0, column=1, columnspan = 2) |
| 27 |
text_var.set("i") |
| 28 |
|
| 29 |
button = Button(root, text="Fill", fg="black", command=fill) |
| 30 |
button.grid(row=1, column=1) |
| 31 |
|
| 32 |
button2 = Button(root, text="Close", fg="black", command=root.quit) |
| 33 |
button2.grid(row=1, column=2) |
| 34 |
|
| 35 |
root.mainloop() |
| 36 |
|