]>
Commit | Line | Data |
---|---|---|
29f0e748 MR |
1 | import gi |
2 | gi.require_version("Gtk", "3.0") | |
3 | from gi.repository import Gtk | |
4 | ||
5 | class Textview: | |
6 | def __init__(self): | |
7 | self.scrolledWindow = Gtk.ScrolledWindow() | |
8 | self.scrolledWindow.set_hexpand(True) | |
9 | self.scrolledWindow.set_vexpand(True) | |
10 | self.textview = Gtk.TextView() | |
11 | self.textview.set_wrap_mode(Gtk.WrapMode.WORD) | |
12 | self.scrolledWindow.add(self.textview) | |
13 | ||
14 | def getScrolledWindow(self): | |
15 | return self.scrolledWindow | |
16 | ||
17 | def getTextview(self): | |
18 | return self.textview | |
19 | ||
20 | def getText(self): | |
21 | textbuffer = self.textview.get_buffer() | |
22 | start = textbuffer.get_start_iter() | |
23 | end = textbuffer.get_end_iter() | |
24 | return textbuffer.get_text(start, end, False) | |
25 | ||
26 | def setText(self, text): | |
27 | textbuffer = self.textview.get_buffer() | |
28 | textbuffer.set_text(text) |