📜  显示数据表网格的python代码 - Python代码示例

📅  最后修改于: 2022-03-11 14:46:26.130000             🧑  作者: Mango

代码示例1
try:  from tkinter import *  from tkinter.ttk import *except ImportError :    print("exception in importing module")
class MyWindow(Frame):




    def CreateUI(self):        tv = Treeview(self)        tv['columns'] = ('Name', 'Mobile', 'course')        tv.heading("#0", text='RollNo', anchor='w')        tv.column("#0", anchor="w")        tv.heading('Name', text='Name')        tv.column('Name', anchor='center', width=100)        tv.heading('Mobile', text='Mobile')        tv.column('Mobile', anchor='center', width=100)        tv.heading('course', text='course')        tv.column('course', anchor='center', width=100)        tv.grid(sticky = (N,S,W,E))        self.treeview = tv        self.grid_rowconfigure(0, weight = 1)        self.grid_columnconfigure(0, weight = 1)root = Tk()MyWindow(root)root.mainloop()