Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
import Tkinter, ttk root = Tkinter.Tk() tree_view = ttk.Treeview(root) tree_view.pack() test_id = tree_view.insert('', 0, text = "test") root.mainloop()
这将显示一个窗口:
注意“测试”的左边距。 是否可以检索/设置此边距的值?
“边距”似乎是为树项目显示“加号”和“减号”图标的地方。 隐藏它:
import Tkinter, ttk root = Tkinter.Tk() tree_view = ttk.Treeview(root, show='headings', columns=('1')) tree_view.pack() tree_view.insert('', 'end', values = ('test')) root.mainloop()