title: GTK4 ApplicationWindow that is also a ScrolledWindow?
body: <p>Here is a minimal GTK 4 app written using the Python bindings, based on <a href="https://github.com/Taiko2k/GTK4PythonTutorial" rel="nofollow noreferrer">this tutorial</a>. It displays a window with a very long block of text:</p>
  <pre class="lang-py prettyprint-override"><code>import sys
  import gi
  gi.require_version('Gtk', '4.0')
  gi.require_version('Adw', '1')
  from gi.repository import Gtk, Adw
  
  
  class MainWindow(Gtk.ApplicationWindow):
      def __init__(self, *args, **kwargs):
          super().__init__(*args, **kwargs)
          long_label = Gtk.Label.new(&quot;Here is a very long chunk of text.\n&quot; * 100)
          self.set_child(long_label)
  
  class MyApp(Adw.Application):
      def __init__(self, **kwargs):
          super().__init__(**kwargs)
          self.connect('activate', self.on_activate)
  
      def on_activate(self, app):
          self.win = MainWindow(application=app)
          self.win.present()
  
  if __name__ == &quot;__main__&quot;:
      app = MyApp(application_id=&quot;com.example.GtkApplication&quot;)
      app.run(sys.argv)
  </code></pre>
  <p>The tutorial uses the class <code>Gtk.ApplicationWindow</code> for the MainWindow, which lets you set the <code>application_id</code> in the main function and other convenient features.</p>
  <p>However, the default <code>Gtk.ApplicationWindow</code> does <em>not</em> include a scrollbar. Rather than build one manually, it seems the best way to do this is to make my main window an instance of <code>Gtk.ScrolledWindow</code>, documented <a href="https://docs.gtk.org/gtk4/class.ScrolledWindow.html" rel="nofollow noreferrer">here</a>, which lets you specify the scroll behavior etc. at a high level.</p>
  <p>Unfortunately, dropping <code>Gtk.ScrolledWindow</code> in place of <code>Gtk.ApplicationWindow</code> causes an error:</p>
  <pre><code>TypeError: gobject `__main__+MainWindow' doesn't support property `application'
  </code></pre>
  <ul>
  <li><strong>Is there a way to create a <code>Gtk.ApplicationWindow</code> that is also a <code>Gtk.ScrolledWindow</code>?</strong></li>
  <li><strong>If not, what is the best way to get a scrollbar in my main window?</strong>'</li>
  </ul>
  <p>(I have added the <code>pygobject</code> tag because it is the language of my MWE, but I think that my question is agnostic with respect to the binding language.)</p>