Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

After a few tries I implemented a workaround where I set the url in the stylesheet programatically:

image_path = os.path.join(rospkg.RosPack().get_path('rqt_custom_plugin'), 'resource', 'img') + "myImg.png"

css_base = """
background: url(<img_path>) no-repeat center center;
background-color:#1F1E24;
"""
css = css_base.replace("<img_path>", img_path)

self._widget.my_button.setStyleSheet(css)