Portál AbcLinuxu, 21. prosince 2025 08:33
#============================================================================
# Test-Function
#----------------------------------------------------------------------------
if __name__ == '__main__':
from Tkinter import Tk, Label, Button
import pprint
prn = pprint.PrettyPrinter(indent = 6).pprint
def test_cmd(event=None):
if event.i == 0:
return '%i, %i' % (event.r, event.c)
else:
return 'set'
def browsecmd(event):
print "event:", event.__dict__
print "curselection:", test.curselection()
print "active:", test.index('active', 'row')
print "anchor:", test.index('anchor', 'row')
root = Tk()
#root.tk.call('load', '', 'Tktable')
var = ArrayVar(root)
for y in range(-1, 4):
for x in range(-1, 5):
index = "%i,%i" % (y, x)
var.set(index, index)
label = Label(root, text="Proof-of-existence test for Tktable")
label.pack(side = 'top', fill = 'x')
quit = Button(root, text="QUIT", command=root.destroy)
quit.pack(side = 'bottom', fill = 'x')
test = Table(root,
rows=10,
cols=5,
state='disabled',
width=6,
height=6,
titlerows=1,
titlecols=1,
roworigin=-1,
colorigin=-1,
selectmode='browse',
selecttype='row',
rowstretch='unset',
colstretch='last',
browsecmd=browsecmd,
flashmode='on',
variable=var,
usecommand=0,
command=test_cmd)
test.pack(expand=1, fill='both')
test.tag_configure('sel', background = 'yellow')
test.tag_configure('active', background = 'blue')
test.tag_configure('title', anchor='w', bg='red', relief='sunken')
root.mainloop()
#----------------------------------------------------------------------------
Jinak našel jsem to na CVS tady.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.