I am working on issue, Help Link Button #65. I would like to launch a help webpage when the user pushes the “Help” button. This seems fairly simple I know, but I finally have a little time to start learning. Is this something I can do in qreads.py? How do I associate launching my URL with the button?
Your local variable webWidget is getting destroyed at the end of the method. You can instead define a self.web_widget = None in the __init__ method of your class and then use it in your showSlicerQREADSHelp and then your window should be persistent.
Instead of using the name helpButtonWebWidget, consider using helpWebWidget, the fact a button is used to display it is not relevant.
consider using properly formatted docstring for the function:
def showSlicerQREADSHelp(self):
"""Display the help website of the application using a non-modal dialog
"""
[...]
to ensure the existing widget is updated if the user click multiple time on the button, consider doing something like this:
def showSlicerQREADSHelp(self):
"""Display the help website of the application using a non-modal dialog
"""
if self.helpButtonWebWidget is None:
self.helpButtonWebWidget = slicer.qSlicerWebWidget()
self.helpButtonWebWidget.url = qt.QUrl('http://www.google.com')
self.helpButtonWebWidget.show()
To reference code block in discourse, consider using the backtick. For example, here is a screenshot of how I edited your last comment: