在python

时间:2018-05-27 08:32:08

标签: python tkinter

我不能在python中使用bbox。

编写的代码

bx=ttk.Treeview.bbox(db_rslt,"aman don",column='4')
bx.configure(text='don')

它给我一个像

这样的错误
File "C:\Users\Amandip\Anaconda3\lib\tkinter\ttk.py", line 1191, in bbox
    return self._getints(self.tk.call(self._w, "bbox", item, column)) or ''
_tkinter.TclError: bad option "bbox": must be cget or configure

1 个答案:

答案 0 :(得分:0)

这是一个最小的Treeview http://grails.asia/groovy-array-manipulation-examples 示例。

.bbox

<强>输出

import tkinter as tk
from tkinter import ttk

root = tk.Tk()
tree = ttk.Treeview(root, columns=2)
tree.pack()

#Add an item to the tree
iid = tree.insert('', 0, text='hello')

# Make sure GUI is rendered and item is visible before trying to get its bounding box
root.update()

bbox = tree.bbox(iid, column=0)
print('bbox', bbox)
root.mainloop()