在大熊猫数据框架和pycharm上单击超链接
我有一个代码,该代码打开了具有播放列表和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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 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.