本文整理汇总了Python中higwidgets.higboxes.HIGHBox.check_resize方法的典型用法代码示例。如果您正苦于以下问题:Python HIGHBox.check_resize方法的具体用法?Python HIGHBox.check_resize怎么用?Python HIGHBox.check_resize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类higwidgets.higboxes.HIGHBox
的用法示例。
在下文中一共展示了HIGHBox.check_resize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HIGTextEditor
# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import check_resize [as 别名]
class HIGTextEditor(HIGScrolledWindow):
def __init__(self):
HIGScrolledWindow.__init__(self)
self.connect('expose_event', self.__expose)
self.__auto_scroll = False
self.__create_widgets()
def __create_widgets(self):
self.__hbox = HIGHBox(spacing=6)
self.__textbuffer = gtk.TextBuffer()
self.__textview = gtk.TextView(self.__textbuffer)
self.__linebuffer = gtk.TextBuffer()
self.__lineview = gtk.TextView(self.__linebuffer)
self.__lineview.set_justification(gtk.JUSTIFY_RIGHT)
self.__lineview.set_editable(False)
self.__lineview.set_sensitive(False)
self.__hbox._pack_noexpand_nofill(self.__lineview)
self.__hbox._pack_expand_fill(self.__textview)
self.add_with_viewport(self.__hbox)
def __expose(self, widget, event):
# code to fix a gtk issue that don't show text correctly
self.__hbox.check_resize()
def _set_auto_scroll(self, value):
self.__auto_scroll = value
def _set_editable(self, editable):
self.__textview.set_editable(False)
def _modify_font(self, font):
self.__textview.modify_font(font)
self.__lineview.modify_font(font)
def _set_text(self, text):
if text != "":
count = text.count('\n') + text.count('\r')
lines = range(1, count + 2)
lines = [str(i).strip() for i in lines]
self.__textbuffer.set_text(text)
self.__linebuffer.set_text('\n'.join(lines))
if self.__auto_scroll:
self.bw_set_scroll_down()
else:
self.__textbuffer.set_text("")
self.__linebuffer.set_text("")
def _get_text(self):
return self.__textbuffer.get_text(self.__textbuffer.get_start_iter(),
self.__textbuffer.get_end_iter())
def _set_scroll_down(self):
self.get_vadjustment().set_value(self.get_vadjustment().upper)