File: sheet-example

package info (click to toggle)
python-tksheet 7.4.16%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,560 kB
  • sloc: python: 25,406; sh: 27; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 1,024 bytes parent folder | download
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
34
35
36
37
38
39
40
41
#!/bin/sh
set -efu

pys="$(py3versions -s 2> /dev/null)"

cat <<EOF > sheet-example.py 
#!/usr/bin/python

from tksheet import Sheet
import tkinter as tk


class demo(tk.Tk):
    def __init__(self):
        tk.Tk.__init__(self)
        self.grid_columnconfigure(0, weight = 1)
        self.grid_rowconfigure(0, weight = 1)
        self.frame = tk.Frame(self)
        self.frame.grid_columnconfigure(0, weight = 1)
        self.frame.grid_rowconfigure(0, weight = 1)
        self.sheet = Sheet(self.frame,
                           data = [[f"Row {r}, Column {c}\nnewline1\nnewline2" for c in range(50)] for r in range(500)])
        self.sheet.enable_bindings()
        self.frame.grid(row = 0, column = 0, sticky = "nswe")
        self.sheet.grid(row = 0, column = 0, sticky = "nswe")
        # after 3s to exit the program
        self.after(3000, self.quit)


app = demo()
app.mainloop()
EOF

chmod +x sheet-example.py

for py in $pys; do
	echo "=== $py ==="
    HOME=/tmp xvfb-run -a $py ./sheet-example.py 2>&1
done