我想将 Yandex.Money“捐赠”html 按钮嵌入到我的 GTK3 (Python) 应用程序中。有可能吗?
这是按钮的代码:
<iframe allowtransparency="true" src="https://money.yandex.ru/embed/small.xml?uid=41001442490707&button-text=04&button-size=l&button-color=orange&targets=Some+text!&default-sum=50" frameborder="0" height="54" scrolling="no" width="auto"></iframe>
最佳答案
是的;您必须使用 WebKit.WebView
小部件并在其中加载按钮的 HTML 代码。
由于上述解决方案对于仅一个按钮来说有点大材小用,也许最好自己将按钮创建为 Gtk.Button
,并访问 Yandex.Money 的 API(如果他们有一个) )在其clicked
信号处理程序中。
其他信息:
以下是监听新窗口和导航信号的示例:
webview.connect('navigation-policy-decision-requested', _on_navigation)
webview.connect('new-window-policy-decision-requested', _on_navigation)
def _on_navigation(webview, frame, request, action, decision):
print 'Tried to navigate to {}'.format(request.props.uri)
return False # not handled, proceed with default action
关于python - 在 GTK3 应用程序中嵌入 html 按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17511306/