本文整理汇总了Python中tkinter.ttk.Treeview类的典型用法代码示例。如果您正苦于以下问题:Python Treeview类的具体用法?Python Treeview怎么用?Python Treeview使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Treeview类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: MainWindow
class MainWindow(Frame):
"""
Macro class for the main program window
"""
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.parent.title('PyNBTx %s' % __version__)
self.style = Style()
self.style.theme_use('default')
self.style.configure('TButton', padding=0)
self.pack(fill=BOTH, expand=1)
self.menu = MainMenu(root)
self.toolbar = ToolBar(self)
self.tree = Treeview(self, height=20)
self.tree_display = TreeDisplay(self.tree)
self.ui_init()
def ui_init(self):
root['menu'] = self.menu
self.toolbar.pack(anchor=NW, padx=4, pady=4)
self.tree.column('#0', width=300)
self.tree.pack(fill=BOTH, anchor=NW, padx=4, pady=4)
开发者ID:ievans3024,项目名称:PyNBTx,代码行数:29,代码来源:__init__.py
示例2: __init__
def __init__(self, master=None):
self._kspelement = None
Treeview.__init__(self, master)
self.pack(expand=1, fill='both')
self['columns'] = self._columns
self['show'] = 'headings'
[self.heading(column, text=column) for column in self['columns']]
self.bind('<Double-1>', self._callback)
开发者ID:dan2082,项目名称:KSPData,代码行数:8,代码来源:treeview_kspobjects.py
示例3: Mk_Book_display
def Mk_Book_display(book, name):
w = book.page(name)
disp = Frame(w)
tree_columns = ('book_no', 'book_name', 'book_author', 'book_publisher', 'in_out_status')
Entries=Treeview( disp,
columns=tree_columns,
show="headings"
)
global_bucket['book_shelf'] = Entries
vsb = Scrollbar ( disp,
orient="vertical",
command=Entries.yview)
Entries.configure(yscrollcommand=vsb.set)
for col,width in zip(tree_columns,(4,20,10,5,6)):
Entries.heading(col, text=col.title(), anchor='w')
Entries.column(col, width=1)
vsb.pack(side=RIGHT,fill=Y)
Entries.pack(fill=BOTH, expand=1)
disp.pack(fill=BOTH, expand=1)
update()
开发者ID:peruraj,项目名称:Intelligent_library,代码行数:26,代码来源:frontend.py
示例4: __init__
def __init__(self, master, **args):
super().__init__(master)
# Parse Treeview options for the Treeview
opts = {x:args[x] for x in args if x in tree_options}
# Create child controls
self._vscroll = Scrollbar(self)
self._hscroll = Scrollbar(self, orient=HORIZONTAL)
opts['yscrollcommand'] = self._vscroll.set
opts['xscrollcommand'] = self._hscroll.set
self._tree = Treeview(self, **opts)
# Setup the child controls
self._init_controls()
# Link some of the treeview's controls to this control
self.item = self._tree.item
self.tag_bind = self._tree.tag_bind
self.tag_bind = self._tree.tag_configure
self.insert = self._tree.insert
self.delete = self._tree.delete
self.detach = self._tree.detach
self.heading = self._tree.heading
# If a header argument was passed in, then use it
self.set_headers(args.get('headers'))
开发者ID:blforce,项目名称:SuperWidgets,代码行数:28,代码来源:ScrollableTreeview.py
示例5: __init__
def __init__(self):
super().__init__()
self.title('Treepace Tree Transformation GUI Demo')
self.geometry('640x400')
self.resizable(False, False)
self.tree_frame = Frame()
self.tree_button = Button(self.tree_frame, text="Load tree",
command=self.load)
self.tree_button.pack(expand=True, fill=BOTH)
self.tree_text = Text(self.tree_frame, width=20)
self.tree_text.pack(expand=True, fill=BOTH)
self.tree_text.insert('1.0', DEFAULT_TREE)
self.tree_frame.pack(side=LEFT, expand=True, fill=BOTH)
self.program_frame = Frame()
self.program_button = Button(self.program_frame, text="Transform",
command=self.transform)
self.program_button.pack(expand=True, fill=BOTH)
self.program_text = Text(self.program_frame, width=60, height=8)
self.program_text.pack(expand=True, fill=BOTH)
self.program_text.insert('1.0', DEFAULT_PROGRAM)
self.tv = Treeview(self.program_frame)
self.tv.pack(expand=True, fill=BOTH)
self.program_frame.pack(side=LEFT, expand=True, fill=BOTH)
GuiNode.tv = self.tv
self.load()
开发者ID:sulir,项目名称:treepace,代码行数:27,代码来源:gui.py
示例6: __init__
def __init__(self, master, names):
self.widget = Frame(master)
self._tree = Treeview(self.widget, columns='name')
self._tree.grid(row=0,column=0, sticky=(N,S,W,E))
self._tree.view = self
self.widget.columnconfigure(0, weight=1)
self.widget.rowconfigure(0,weight=1)
self._tree.column('name', width=50)
self._tree['show'] = 'tree'
actions = {'edit': lambda e: self.edit(),
'search': lambda e: self.search(),
'focus_next': lambda e: self.focus_next(),
'focus_prev': lambda e: self.focus_prev(),
'select': lambda e: self._tree.selection_toggle(self._tree.focus()),
'clear_selection': lambda e: self._tree.selection_set([])
}
kb.make_bindings(kb.tagview, actions, self._tree.bind)
self._iids = dict()
self._names = dict()
logger.debug('Names: %s', names)
self.widget.focus_set = self._tree.focus_set
for name in sorted(names):
iid = self._tree.insert('', 'end', text=name)
self._names[iid] = name
self._iids[name] = iid
self._scroll = Scrollbar(self.widget, command=self._tree.yview)
self._tree['yscrollcommand'] = self._scroll.set
self._scroll.grid(row=0, column=1, sticky=(N, S))
self.widget.columnconfigure(1, weight=0)
开发者ID:gokai,项目名称:tim,代码行数:29,代码来源:tagview.py
示例7: __init__
def __init__(self, ui: SharedrawUI):
Frame.__init__(self, ui.root)
self.parent = ui.root
self.ui = ui
self.parent.title("Sharedraw [%s:%s, id: %s]" % (self.ui.peer_pool.ip, self.ui.peer_pool.port, own_id))
self.drawer = Drawer(self.parent, WIDTH, HEIGHT, self.save)
self.clients_table = Treeview(self.parent, columns=('R', 'G', 'from'))
self.clients_table.heading('#0', text='Id')
self.clients_table.heading('R', text='R')
self.clients_table.heading('G', text='G')
self.clients_table.heading('from', text='Otrzymano od:')
self.clients_table.pack()
self.token_owner_label = MutableLabel(self.parent, 'Posiadacz tokena: %s', lambda s: s if s else 'Nikt', None)
self.token_owner_label.pack()
self.locked_label = MutableLabel(self.parent, 'Tablica %s', lambda b: 'zablokowana' if b else 'odblokowana',
False)
self.locked_label.pack()
# Przycisk czyszczenia
self.clean_btn = self._create_button(text="Czyść", func=self.clean)
# Przycisk podłączenia
self.connect_btn = self._create_button(text="Podłącz", func=self.connect)
# Przycisk żądania przejęcia na własność
self.req_btn = self._create_button(text="Chcę przejąć tablicę", func=self._make_request)
# Rezygnacja z posiadania blokady
self.resign_btn = self._create_button(text='Zrezygnuj z blokady', func=self._resign)
开发者ID:siekiera,项目名称:Sharedraw,代码行数:26,代码来源:ui.py
示例8: __init__
def __init__(self,data,y,v='план'):
w=Toplevel()
w.wm_title('Доп')
w.columnconfigure(0,weight=1)
w.rowconfigure(0,weight=1)
years=sorted(data.keys())
cols=data['2013']['degurs'] # ЗАГЛУШКА : список дежурных
self.t=Treeview(w,columns=cols)
for c in cols:
self.t.heading(c,text=c)
self.t.column(c,width=65,anchor='center')
self.t.tag_configure('табель',background='green')
self.t.tag_configure('ош',background='red')
#self.t.tag_configure('табель',background='green')
self.scrX=Scrollbar(w,orient='horizontal',command=self.t.xview)
self.scrY=Scrollbar(w,orient='vertical',command=self.t.yview)
self.t['xscrollcommand']=self.scrX.set
self.t['yscrollcommand']=self.scrY.set
self.t.grid(row=0,column=0,sticky=N+S+E+W)
self.scrX.grid(row=1,column=0,sticky=E+W)
self.scrY.grid(row=0,column=1,sticky=N+S)
for y in years:
x=self.t.insert('','end',text=y)
eeY=[]
for m in ['01','02','03','04','05','06','07','08','09','10','11','12']:
d0=data[y]
if m not in d0: continue
d=d0[m]
rez=dict()
tag=''
if v=='авто':
if 'табель' in d['degur']:
vv='табель'
tag=vv
else:
vv='план'
elif v=='табель':
if 'табель' not in d['degur']:
vv='план'
tag='ош'
else:
vv=v
tag=vv
else:
vv=v
for j,s in d['degur'][vv].items():
rez[j]=analyse2(s,d)
NUL=(0,0,0,0,0,0,0)
ee=[rez.get(j,NUL)[0]-rez.get(j,NUL)[3]+rez.get(j,NUL)[4] for j in cols]
eeY.append(ee)
self.t.insert(x,'end',text=m,values=[x or '-' for x in ee],tag=tag)
eeY=[sum(x) for x in zip(*eeY)]
self.t.insert(x,'end',text='итого',values=eeY,tag='Y')
开发者ID:da-sher,项目名称:degur,代码行数:57,代码来源:degur.py
示例9: __init__
def __init__(self, controller):
Treeview.__init__(self, controller)
self.controller = controller
self.recentFile = controller.recentFile
self.browseInitialDir = controller.browseInitialDir
self.maxRecentVideos = controller.maxRecentVideos
self.initLastFile()
self['height'] = 10
self['selectmode'] = 'browse'
self['columns'] = ('lastOpen')
self.column('#0', width=350, anchor='center')
self.heading('#0', text='File')
self.column('lastOpen', width=100, anchor='center')
self.heading('lastOpen', text='Last play')
self.bind("<Double-1>", self.playSelectedVideo)
self.bind("<ButtonRelease-1>", self.selectVideo)
开发者ID:frama986,项目名称:omx-simple-interface,代码行数:20,代码来源:filesTree.py
示例10: __init__
def __init__(self, master):
Frame.__init__(self, master, bg="black")
scroll = Scrollbar(self)
self.tree = Treeview(self, yscrollcommand=scroll.set)
scroll.config(command=self.tree.yview)
self.items = []
self.tree.pack(side=LEFT, fill=BOTH, expand=1)
scroll.pack(side=LEFT, fill=Y)
开发者ID:youngmit,项目名称:spectacuplot,代码行数:11,代码来源:DataTree.py
示例11: _maketree
def _maketree(parent_tree, wallpapers, conf):
tree = Treeview(parent_tree)
i = 0
if conf['type'] == 'workspace':
for workspace, wallpaper_files in wallpapers.items():
i += 1
index = str(i)
tree.insert('', 'end', index, text=workspace)
for j, wallpaper_file in enumerate(wallpaper_files):
inner_index = index + '_' + str(j)
tree.insert(index, 'end', inner_index, text=wallpaper_file)
elif conf['type'] == 'desktop':
for wallpaper_file in wallpapers:
i += 1
index = str(i)
tree.insert('', 'end', index, text=wallpaper_file)
tree.pack()
开发者ID:fernandoenzo,项目名称:wallpapoz,代码行数:17,代码来源:wallpapoz_main_window.py
示例12: Table
class Table(Frame):
def __init__(self, parent, title, columns):
Frame.__init__(self, parent)
self.pack(expand=YES, fill=BOTH)
self.title_lbl = Label(self, text=title, font=GENERAL_FONT)
self.table_tree = Treeview(self, columns=columns)
# добавить Scrollbar
self.scroll = Scroll(self, orient=VERTICAL, command=self.table_tree.yview)
self.table_tree['yscroll'] = self.scroll.set
for i in range(len(columns)):
self.table_tree.heading(columns[i], text=columns[i])
self.place_widgets()
def place_widgets(self):
self.title_lbl.pack(side=TOP, fill=X, expand=YES)
self.table_tree.pack(side=LEFT, fill=BOTH, expand=YES)
self.scroll.pack(side=RIGHT, fill=Y, expand=YES)
开发者ID:fargelus,项目名称:SAPR,代码行数:21,代码来源:generaltable.py
示例13: Window
class Window(Tk):
def __init__(self):
super().__init__()
self.title('Treepace Tree Transformation GUI Demo')
self.geometry('640x400')
self.resizable(False, False)
self.tree_frame = Frame()
self.tree_button = Button(self.tree_frame, text="Load tree",
command=self.load)
self.tree_button.pack(expand=True, fill=BOTH)
self.tree_text = Text(self.tree_frame, width=20)
self.tree_text.pack(expand=True, fill=BOTH)
self.tree_text.insert('1.0', DEFAULT_TREE)
self.tree_frame.pack(side=LEFT, expand=True, fill=BOTH)
self.program_frame = Frame()
self.program_button = Button(self.program_frame, text="Transform",
command=self.transform)
self.program_button.pack(expand=True, fill=BOTH)
self.program_text = Text(self.program_frame, width=60, height=8)
self.program_text.pack(expand=True, fill=BOTH)
self.program_text.insert('1.0', DEFAULT_PROGRAM)
self.tv = Treeview(self.program_frame)
self.tv.pack(expand=True, fill=BOTH)
self.program_frame.pack(side=LEFT, expand=True, fill=BOTH)
GuiNode.tv = self.tv
self.load()
def load(self):
if self.tv.exists('root'):
self.tv.delete('root')
program = self.tree_text.get('1.0', END)
self.tree = Tree.load(program, IndentedText, GuiNode)
def transform(self):
try:
self.tree.transform(self.program_text.get('1.0', END))
except Exception as e:
messagebox.showerror("Transformation error", e)
开发者ID:sulir,项目名称:treepace,代码行数:40,代码来源:gui.py
示例14: DeviceToFrame
class DeviceToFrame(CopilotInnerFrame):
def __init__(self, master, config, state):
super(DeviceToFrame, self).__init__(master, config)
self._state = state
if self._state.action == 'copy':
self._frame_lbl['text'] = 'Copy To Directory'
elif self._state.action == 'delete':
self._frame_lbl['text'] = 'Delete From Directory'
self._next_btn['command'] = self._next_cmd
self._tree = Treeview(self._master, columns=('size'))
self._tree.heading('size', text='Size')
self._tree.grid(row=1, column=0, columnspan=3, sticky='nsew')
self._tree.configure(yscrollcommand=self._sb.set)
self._sb['command'] = self._tree.yview
self._item_paths = {}
self._populate_tree(self._state.to_device.part().mount())
def _next_cmd(self):
cur_item = self._tree.focus()
cur_path = self._item_paths.get(cur_item, '')
if cur_path != '':
self._state.device_to_path = cur_path
self._new_state_window(CopyFileFrame, self._state)
def _populate_tree(self, tree_root):
self._item_paths = {}
def insert_path(tree, path, parent_id):
dirs = [e for e in scandir(path) if e.is_dir()]
dirs.sort(key=lambda e: e.name)
for d in dirs:
dir_name = d.name
dir_id = '{}-{}'.format(parent_id, dir_name)
dir_path = os.path.join(path, dir_name)
tree.insert(parent_id, 'end', dir_id, text=dir_name, tags=('dir'))
self._item_paths[dir_id] = dir_path
try:
insert_path(tree, dir_path, dir_id)
except:
pass
insert_path(self._tree, tree_root, '')
tree = self._tree
tree.tag_configure('dir', font=self._config.item_font)
tree.tag_configure('file', font=self._config.item_font)
tree.tag_configure('file_odd', background='light grey')
开发者ID:aphistic,项目名称:copilot,代码行数:52,代码来源:device_to.py
示例15: CreateUI
def CreateUI(self, classInstance):
self.headers = [
"Customers",
"Inter-arrival time",
"Arrival time",
"Service time",
"Waiting time in queue",
"Time when service begins",
"Time when service ends",
"Time customer spends in system",
"Idle time of server"
]
self.contents =[]
# populates the table from other class to generate the tkinter table
def compilelist(classInstance):
self.contents.append(classInstance.intarrival())
self.contents.append(classInstance.arrival())
self.contents.append(classInstance.service())
self.contents.append(classInstance.queuewait())
self.contents.append(classInstance.servbegin())
self.contents.append(classInstance.servend())
self.contents.append(classInstance.custspend())
self.contents.append(classInstance.idle())
return self.contents
# Calling the function
compilelist(classInstance)
self.rearrange = []
for row in zip(*self.contents):
self.rearrange.append(row)
self.headdata = []
for x in range(len(self.contents[0])):
self.headdata.append(x+1)
header_lists = []
tv = Treeview(self)
tv['columns'] = (self.headers)
for x in range(len(self.headers)):
tv.heading("#%s"%x, text=self.headers[x], anchor='center')
tv.column ("#%s"%x, anchor='center', width="150")
tv.grid(sticky = (N,S,W,E))
self.treeview = tv
self.grid_rowconfigure(0, weight = 1)
self.grid_columnconfigure(0, weight = 1)
开发者ID:tushortz,项目名称:eventsim,代码行数:52,代码来源:simevent.py
示例16: createDisplayTable
def createDisplayTable(self):
for child in root.winfo_children():
child.destroy()
self.tree = Treeview(height="15", columns=("Name", "Purchase Date", "Quantity", "Price"))#, "Description"))
self.tree.pack()
self.tree.heading('#1', text = "Name", anchor = CENTER)
self.tree.heading('#2', text = "Purchase Date", anchor = CENTER)
self.tree.heading('#3', text = "Quantity", anchor = CENTER)
self.tree.heading('#4', text = "Price", anchor = CENTER)
self.tree.column('#1', minwidth=0, width = 95)
self.tree.column('#2', minwidth=0, width = 95)
self.tree.column('#3', minwidth=0, width = 95)
self.tree.column('#4', minwidth=0, width = 95)
self.tree.column('#0', minwidth=0, width = 0)
开发者ID:willgoishi,项目名称:CSCI_150_AG_Project,代码行数:15,代码来源:GUI_CLASS.py
示例17: __init__
def __init__(self,list,dirlist):
self.root = Tk()
self.root.wm_title("Duplicate_Files")
self.min = None
self.list = list
self.root.geometry('600x600+0+0')
self.tree = Treeview(self.root ,height=15)
self.tree.pack(expand='yes',fill='both')
self.tree.heading('#0',text="files")
self.tree.tag_configure('red',foreground='red')
self.tree.tag_configure('purple',foreground='#cc00ff')
self.tree.bind("<Double-1>",self.onDoubleClick)
self.tree.bind("<<TreeviewOpen>>",self.onOpen)
self.tree.bind("<<TreeviewClose>>",self.onClose)
for path in dirlist:
branch = self.tree.insert('','end',text=path,open=True,tags=(path,'white'))
self.fillTree(path,branch,list)
self.root.mainloop()
开发者ID:bretttjohnson1,项目名称:Duplicate_Discoverer,代码行数:18,代码来源:window.py
示例18: Mk_Status_display
def Mk_Status_display(book, name):
w = book.page(name)
disp = Frame(w)
tree_columns = ('book_no', 'book_name', 'date', 'staff_id', 'staff_name', 'note')
Entries=Treeview( disp,
columns=tree_columns,
show="headings",
)
global_bucket['status_register'] = Entries
vsb = Scrollbar ( disp,
orient="vertical",
command=Entries.yview)
Entries.configure(yscrollcommand=vsb.set)
for col in tree_columns:
Entries.heading(col, text=col.title(), anchor='w')
Entries.column(col, width=0)
vsb.pack(side=RIGHT,fill=Y)
Entries.pack(fill=BOTH, expand=1)
disp.pack(fill=BOTH, expand=1)
update()
开发者ID:peruraj,项目名称:Intelligent_library,代码行数:24,代码来源:frontend.py
示例19: displayGeneralInventory
def displayGeneralInventory(self):
# This creates a table using the function Treeview
self.tree = Treeview(height="20", columns=("Name", "Current Quantity"))
self.tree.pack()
self.tree.heading('#1', text = "Name", anchor = CENTER)
self.tree.heading('#2', text = "Current Quantity", anchor = CENTER)
self.tree.column('#1', minwidth=0, width = 100)
self.tree.column('#2', minwidth=0, width = 100)
self.tree.column('#0', minwidth=0, width = 0)
itemType = self.chooseItemType.get()
if(itemType == "All"):
self.obtainData("Tree")
self.obtainData("Animal")
self.obtainData("Machine")
else:
self.obtainData(itemType)
开发者ID:willgoishi,项目名称:CSCI_150_AG_Project,代码行数:19,代码来源:GUI_CLASS.py
示例20: __init__
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.parent.title('PyNBTx %s' % __version__)
self.style = Style()
self.style.theme_use('default')
self.style.configure('TButton', padding=0)
self.pack(fill=BOTH, expand=1)
self.menu = MainMenu(root)
self.toolbar = ToolBar(self)
self.tree = Treeview(self, height=20)
self.tree_display = TreeDisplay(self.tree)
self.ui_init()
开发者ID:ievans3024,项目名称:PyNBTx,代码行数:19,代码来源:__init__.py
注:本文中的tkinter.ttk.Treeview类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论