def __init__(self, app, master):
super().__init__(master, text="Playlist", padding=4)
self.app = app
bf = ttk.Frame(self)
ttk.Button(bf, text="Move to Top", width=11, command=self.do_to_top).pack()
ttk.Button(bf, text="Move Up", width=11, command=self.do_move_up).pack()
ttk.Button(bf, text="Move Down", width=11, command=self.do_move_down).pack()
ttk.Button(bf, text="Remove", width=11, command=self.do_remove).pack()
bf.pack(side=tk.LEFT, padx=4)
sf = ttk.Frame(self)
cols = [("title", 300), ("artist", 180), ("album", 180), ("length", 60)]
self.listTree = ttk.Treeview(sf, columns=[col for col, _ in cols], height=10, show="headings")
vsb = ttk.Scrollbar(orient="vertical", command=self.listTree.yview)
self.listTree.configure(yscrollcommand=vsb.set)
self.listTree.grid(column=1, row=0, sticky=tk.NSEW, in_=sf)
vsb.grid(column=0, row=0, sticky=tk.NS, in_=sf)
for col, colwidth in cols:
self.listTree.heading(col, text=col.title())
self.listTree.column(col, width=colwidth)
sf.grid_columnconfigure(0, weight=1)
sf.grid_rowconfigure(0, weight=1)
sf.pack(side=tk.LEFT, padx=4)
评论列表
文章目录