python 有个第三方迟源库pyh用来生成HTML,可以试用一下:
from pyh import *
page = PyH('This is PyH page')
page <<h1(cl='center', 'My big title')
table1 = page <帆缓<table(border='1',id='mytable1')
headtr = table1 <<tr(id='headline')
headtr <<td('Head1') <<td('Head2')
tr1 = table1 <<tr(id='line1')
tr1 <<td('r1,c1') <<td('r1,c2')
tr2 = table1 <<tr(id='line2')
tr2 <<td('r2,c1') <<td('r2,c2')
page.printOut()
不同于C#语言,Tkinter库没有提供专门的ListView表格控乱嫌消件,而是使用TreeView,这一点令人觉得有点奇怪,但使用起来也不是太复杂。
举例:哗知实现一个显示联系人的表格:者缺
显示效果:
修改第一行姓名为“张一山”:
def get_size():n=int(input 厅碧("Enter a number between 3 and 8: "))
while (n < 3) or (n > 8):
n = int(input("\tInvalid entry - try again: "))
return n
def get_char():
c =input("Enter a character: ")
while len(c) != 1:
c =input("\tInvalid entry - try again: ")
return c
def print_box():
number = get_size()
c = get_char()
for index in range (number-1):
print(c, 派数end="")
print (c)
for row in range (2,number):
print(c,end="")
for index in range(number-2):
尘伏首 print(" ", end = "")
print(c)
for index in range (number):
print(c, end="")
return None
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)