]> git.datanom.net - lensdatabase.git/blob - textview.py
6502cccd5d549ff1ac99d0db2b514a4f076a15d6
[lensdatabase.git] / textview.py
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)
This page took 0.115655 seconds and 6 git commands to generate.