Below I have some very simple code using WebKit2.WebView in a GtkScrolledWindow to show an HTML page. The vertical scrollbar does show up, but is not scrollable. The content, however, is scrollable: you can scroll it using the scroll wheel of the mouse.
What am I missing?
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('WebKit2', '4.1')
from gi.repository import Gtk, WebKit2
win = Gtk.Window()
win.connect("destroy", Gtk.main_quit)
win.set_default_size(600,400)
sw = Gtk.ScrolledWindow()
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS)
win.add(sw)
webview = WebKit2.WebView()
webview.load_uri("https://solydxk.com")
sw.add(webview)
win.show_all()
Gtk.main()
I thought it could be a theming issue, but testing several themes (Debian, Breeze) did not change this behavior.
This also happens with WebKit2 4.0.
This works with Gtk4:
import gi
gi.require_version('Gtk', '4.0')
gi.require_version('WebKit', '6.0')
from gi.repository import Gtk, WebKit
def on_activate(app):
win = Gtk.ApplicationWindow(application=app)
win.set_default_size(600,400)
webview = WebKit.WebView.new()
webview.load_uri("https://solydxk.com")
win.set_child(webview)
win.present()
app = Gtk.Application()
app.connect('activate', on_activate)
app.run(None)
But unfortunately, that is not an option (I've added the Gtk3 tag).