在GTK3应用程序中嵌入html按钮?

2024-05-18 09:09:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我想嵌入一个Yandex。钱“捐赠”html按钮到我的GTK3(Python)应用程序。有可能吗?在

这是按钮的代码:

<iframe allowtransparency="true" src="https://money.yandex.ru/embed/small.xml?uid=41001442490707&amp;button-text=04&amp;button-size=l&amp;button-color=orange&amp;targets=Some+text!&amp;default-sum=50" frameborder="0" height="54" scrolling="no" width="auto"></iframe>

Tags: 代码texthttpssrctrue应用程序htmlbutton
1条回答
网友
1楼 · 发布于 2024-05-18 09:09:03

是的;您必须使用一个WebKit.WebView小部件并在其中加载按钮的HTML代码。在

由于上面的解决方案对于一个按钮来说有点过分了,也许最好自己创建一个Gtk.Button的按钮,然后访问Yandex。钱的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

相关问题 更多 >