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

标签 python html gtk embed

我想将 Yandex.Money“捐赠”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>

最佳答案

是的;您必须使用 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/

相关文章:

jquery - 使用 jQuery 进行网络聊天

html - 跨越多行

c - 如何创建 nautilus C 扩展

linux - 我可以为 Ubuntu 上的应用程序中的菜单项分配自定义键盘快捷键吗?

python - 在 Python 中浏览文件和子文件夹

python - 自定义 __repr__ 作为从 Enum 派生的类的类方法

python - 用于单圈时间优化的 Gekko(python)

python - 将 Django boolean 值从默认值 "False"更改为类似 "No"的值

jquery - 悬停并使 Accordion 事件暗淡图标

python - ButtonBox 中的同质子级