Completely disable scrollbars on GTK webkit webview?
Question: I want a simple webview based on webkit, with a fixed size (e.g. 200x200) and
without any scrollbars. I use X with no window manager.

I tried the following Python code:

    
    
    import gtk 
    import webkit 
    
    view = webkit.WebView() 
    
    sw = gtk.ScrolledWindow()
    sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
    sw.add(view)
    
    win = gtk.Window(gtk.WINDOW_TOPLEVEL)
    win.add(sw) 
    win.set_default_size(200, 200) 
    win.show_all()
    
    view.open("http://www.blackle.com") 
    
    gtk.main()
    

The scrollbars still show, although they should not.

I also tried to follow a different path and completely remove scrollbars on
GTK by using `~/.gtkrc-2.0`:

    
    
    style "custom-scrollbar-style"
    {
      GtkScrollbar::slider_width = 0
      GtkScrollbar::min-slider-length = 0
      GtkScrollbar::activate_slider = 0
      GtkScrollbar::trough_border = 0
      GtkScrollbar::has-forward-stepper = 0
      GtkScrollbar::has-backward-stepper = 0
      GtkScrollbar::stepper_size = 0
      GtkScrollbar::stepper_spacing = 0
      GtkScrollbar::trough-side-details = 0
      GtkScrollbar::default_border = { 0, 0, 0, 0 }
      GtkScrollbar::default_outside_border = { 0, 0, 0, 0 }
    }
    widget_class "*Scrollbar" style "custom-scrollbar-style"
    

Even with this, it still shows thin white lines on the two sides of the window
where the scrollbars are.

Any ideas?


Answer: ok here's the thing. You don't want a scrollbar but you construct a
Gtk.ScrolledWindow to be the container of WebKit.WebView. If you don't want a
scrollbar, just put inside a container that doesn't implement a
Gtk.Scrollable, say Gtk.Grid. It will not showing scrollbar at all. Few
downsides:

  1. your main window will not down size beyond it's content minimum width and height.
  2. if your view content change size, and it will (unless you restrict every last detail on how your view will be displayed), the window will follow the current size as well
  3. in WebKit.WebView widget, there is no such thing as Gtk.Widget.set_size_request, it will still follow its content. By the way, Gtk.Widget.set_default_size () does not create a fix size for a widget, only set the size when first time it is shown.

