本文整理汇总了Python中kano.gtk3.scrolled_window.ScrolledWindow.set_hexpand方法的典型用法代码示例。如果您正苦于以下问题:Python ScrolledWindow.set_hexpand方法的具体用法?Python ScrolledWindow.set_hexpand怎么用?Python ScrolledWindow.set_hexpand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kano.gtk3.scrolled_window.ScrolledWindow
的用法示例。
在下文中一共展示了ScrolledWindow.set_hexpand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from kano.gtk3.scrolled_window import ScrolledWindow [as 别名]
# 或者: from kano.gtk3.scrolled_window.ScrolledWindow import set_hexpand [as 别名]
def __init__(self, border_width=2):
Gtk.EventBox.__init__(self)
# Very hacky way to get a border (gg GTK): create a grey event box
# which is a little bigger than the white event box containing the
# widget
apply_styling_to_screen(
os.path.join(common_css_dir, 'multiline_entry.css')
)
self.get_style_context().add_class('gray-box')
widget_box = Gtk.EventBox()
widget_box.get_style_context().add_class('white-box')
widget_box.set_margin_left(border_width) # gray border width (px)
widget_box.set_margin_right(border_width)
widget_box.set_margin_top(border_width)
widget_box.set_margin_bottom(border_width)
self.add(widget_box)
# putting the TextView into a ScrolledWindow so it doesn't resize
# horiz & vert
scrolled_window = ScrolledWindow()
scrolled_window.set_vexpand(True)
scrolled_window.set_hexpand(True)
scrolled_window.set_policy(
Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC
)
scrolled_window.apply_styling_to_widget()
widget_box.add(scrolled_window)
# creating the actual TextView
self.text_view = Gtk.TextView()
# break on words, then chars
self.text_view.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
# the white border inside the thin gray border
self.text_view.set_margin_left(10)
self.text_view.set_margin_right(10)
self.text_view.set_margin_top(10)
self.text_view.set_margin_bottom(10)
scrolled_window.add(self.text_view)
# placeholder text logic
self.placeholder_text = None
self.placeholder_text_set = False
self.restore_buffer_handler_id = None
self.clear_buffer_handler_id = None
self.text_view.set_buffer(KanoTextBuffer())
text_buffer = self.text_view.get_buffer()
text_buffer.connect('changed', self._on_changed)