在大熊猫数据框架和pycharm上单击超链接

发布于 2025-01-22 00:57:10 字数 827 浏览 1 评论 0原文

我有一个代码,该代码打开了具有播放列表和URL链接到音乐的CSV文件。当使用pandas dataframe时,当框架在tkinter窗口上打开时,URL超链接不可单击。.我尝试从此 pandas dataframe中的可单击链接

我拥有的代码如下:

    df = pd.DataFrame(data, columns=['Title', 'Link'])

    cols = list(df.columns)
    tree = ttk.Treeview(my_w)
    tree.pack()
    tree["columns"] = cols
    for i in cols:
        tree.column(i, anchor="w")
        tree.heading(i, text=i, anchor='w')

    for index, row in df.iterrows():
       tree.insert("", 0, text=index, values=list(row))

但是链接列不是可单击的

“超链接不单击”

I have a code that opens a csv file that has playlist and url links to music. When the frame opens on a tkinter window while using pandas dataframe the url hyperlinks are not clickable.. I have tried doing the following from this clickable link in pandas dataframe

The code i have is the following:

    df = pd.DataFrame(data, columns=['Title', 'Link'])

    cols = list(df.columns)
    tree = ttk.Treeview(my_w)
    tree.pack()
    tree["columns"] = cols
    for i in cols:
        tree.column(i, anchor="w")
        tree.heading(i, text=i, anchor='w')

    for index, row in df.iterrows():
       tree.insert("", 0, text=index, values=list(row))

but the Link column is not clickable

Hyperlink not clickable

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倥絔 2025-01-29 00:57:10

如果您使用 tkinter 来创建桌面应用程序,则需要一种将超链接发送到Web浏览器的方法。您是否尝试过此示例使用Web浏览器软件包?

tkinter 中的超链接

我建议首先获得一个可单击的超链接以在熊猫数据框架之外工作。一旦运行正常,就可以将工作概念插入iTerrows循环中。

If you're using Tkinter to create a desktop app, you'll need a way to send a hyperlink to your web browser. Have you tried this example that uses the web browser package?

Hyperlink in Tkinter

I would suggest getting a single clickable hyperlink to work outside of the pandas data frame first. Once that's functioning properly, insert the working concept in your iterrows loop.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文