I’m working on a text editing application, initially aimed at serving literary writers. I’m using Gtk4, Python and Flatpak and I’m having some difficulties implementing things the way I want. So I have a few questions:
1 - I know that it is possible to display the same Gtk.TextBuffer in several Gtk.TextViews, would it be possible to link a Gtk.TextView to a subset of the content of a TextBuffer?
2 - Would it be possible to disable the built-in vertical Scrollbar of a Gtk.TextView and give it a fixed size? Something like an editable Gtk.Inscription?
What I’m trying to reproduce is the visual division of pages. Creating each page as a Gtk.TextView with its own Gtk.TextBuffer seems to make it difficult to maintain text flow control between one page and another.
1 - I don’t see how it can be possible… There are ways to set some parts of text invisible by applying tags, but it’s per-buffer, so will be shared on all views. Maybe use several buffers, add the same text to all of them, but use different tags to set what’s visible depending on buffer.
2 - scrollbars are not controlled by the textview, but by the parent’s scrolledwindow. You can hide the scrollbar by passing GTK_POLICY_EXTERNAL to set_policy()
I’m not sure TextView is the best approach to achieve what you want. If the page separation is just a simple 1px horizontal line, it should be possible, but for more complex styling that will be difficult.