【发布时间】:2021-10-20 17:10:40
【问题描述】:
我的桌面上有一个文件,其中有 100 多个子文件夹,它们都分支出来以组织大量 PDF。我正在尝试制作一个使用 GUI 来更好地访问和打开这些 PDF 的应用程序。 Treeview 将是完美的,但我无法弄清楚如何使用除按钮之外的任何东西来实际打开文件。有人可以告诉我如何使用这些来查找文件路径并打开 pdf 吗?谢谢。
编辑:
基本上,我有一棵看起来像这样的树:
tree = ttk.Treeview(vender_class)
tree.pack(fill=BOTH)
tree.insert(parent='', index='end', iid=1, text="Thresholds")
tree.insert(parent='1', index='end', iid=2, text="Butt Hung")
tree.insert(parent='2', index='end', iid=3, text="THBH")
tree.insert(parent='1', index='end', iid=4, text="Center Hung")
tree.insert(parent='4', index='end', iid=5, text="THCH")
tree.insert(parent='1', index='end', iid=6, text="Offset Hung")
tree.insert(parent='6', index='end', iid=7, text="THOH")
tree.insert(parent='1', index='end', iid=8, text="Other")
tree.insert(parent='8', index='end', iid=9, text="THO")
open_button=ttk.Button(vender_class, text="Open PDF", command=openfile)
open_button.pack()
我希望能够简单地双击最终项目(即“THBH”)并在 Bluebeam 上打开 PDF。如果这不起作用,那么如何将其链接到按钮,以便如果选择“THBH”并按下按钮,它会以这种方式打开 PDF?
【问题讨论】:
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
标签: class pdf tkinter treeview filepath