Sublime Forum

How to navigate to webbrowser only if popup link is clicked

#1

I have used a view.show_popup and used an a tag for the links. But my problem is that the webbrowser is opened as soon as the documentation pops up. I rather want it to open a webpage if and only if the link is clicked.

Here is an example of the code i am using for a package called LangDocs

view.show_popup("<style>%s</style>%s" % (css, doc), max_width=700, on_navigate=webbrowser.open(url))

0 Likes

#2

on_navigate=lambda:webbrowser.open(url)

0 Likes

#4

Thanks but when i editted the file, I got TypeError: <lambda>() takes 0 positional arguments but 1 was given

0 Likes

#5

Thanks I’ve fixed it with lambda x: ......

0 Likes

#6

You could also just specify on_navigate=webbrowser.open.

1 Like