| 1 | #!/bin/sh |
| 2 | set -efu |
| 3 | |
| 4 | pys="$(py3versions -s 2> /dev/null)" |
| 5 | |
| 6 | cat <<EOF > sheet-example.py |
| 7 | #!/usr/bin/python |
| 8 | |
| 9 | from tksheet import Sheet |
| 10 | import tkinter as tk |
| 11 | |
| 12 | |
| 13 | class demo(tk.Tk): |
| 14 | def __init__(self): |
| 15 | tk.Tk.__init__(self) |
| 16 | self.grid_columnconfigure(0, weight = 1) |
| 17 | self.grid_rowconfigure(0, weight = 1) |
| 18 | self.frame = tk.Frame(self) |
| 19 | self.frame.grid_columnconfigure(0, weight = 1) |
| 20 | self.frame.grid_rowconfigure(0, weight = 1) |
| 21 | self.sheet = Sheet(self.frame, |
| 22 | data = [[f"Row {r}, Column {c}\nnewline1\nnewline2" for c in range(50)] for r in range(500)]) |
| 23 | self.sheet.enable_bindings() |
| 24 | self.frame.grid(row = 0, column = 0, sticky = "nswe") |
| 25 | self.sheet.grid(row = 0, column = 0, sticky = "nswe") |
| 26 | # after 3s to exit the program |
| 27 | self.after(3000, self.quit) |
| 28 | |
| 29 | |
| 30 | app = demo() |
| 31 | app.mainloop() |
| 32 | EOF |
| 33 | |
| 34 | chmod +x sheet-example.py |
| 35 | |
| 36 | for py in $pys; do |
| 37 | echo "=== $py ===" |
| 38 | HOME=/tmp xvfb-run -a $py ./sheet-example.py 2>&1 |
| 39 | done |
| 40 | |
| 41 |