亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

pygtk-TextView

系統(tǒng) 1990 0

textview = gtk.TextView(buffer=None)

textview.set_buffer(buffer)

buffer = textview.get_buffer()

textview.set_editable(setting)

setting = textview.get_editable()

textview.set_cursor_visible(setting)

textview.set_wrap_mode(wrap_mode)

其中,wrap_mode如下:

gtk.WRAP_NONE
gtk.WRAP_CHAR
gtk.WRAP_WORD

textview.set_justification(justification)

justification = textview.get_justification()或如下:

gtk.JUSTIFY_LEFT
gtk.JUSTIFY_RIGHT
gtk.JUSTIFY_CENTER

=============

如:

textview.set_left_margin(left_margin)
left_margin = textview.get_left_margin()
textview.set_right_margin(right_margin)
right_margin = textview.get_right_margin()
textview.set_indent(indent)
indent = textview.get_indent()
textview.set_pixels_above_lines(pixels_above_line)
pixels_above_line = textview.get_pixels_above_lines()
textview.set_pixels_below_lines(pixels_below_line)
pixels_below_line = textview.get_pixels_below_lines()
textview.set_pixels_inside_wrap(pixels_inside_wrap)
pixels_inside_wrap = textview.get_pixels_inside_wrap()
textview.set_tabs(tabs)
tabs = textview.get_tabs()






pygtk-TextView
?

    #!/usr/bin/env python

# example textview-basic.py

import pygtk
pygtk.require('2.0')
import gtk

class TextViewExample:
	def toggle_editable(self, checkbutton, textview):
		textview.set_editable(checkbutton.get_active())
	def toggle_cursor_visible(self, checkbutton, textview):
		textview.set_cursor_visible(checkbutton.get_active())
	
	def toggle_left_margin(self, checkbutton, textview):
		if checkbutton.get_active():
			textview.set_left_margin(50)
		else:
			textview.set_left_margin(0)
	
	def toggle_right_margin(self, checkbutton, textview):
		if checkbutton.get_active():
			textview.set_right_margin(50)
		else:
			textview.set_right_margin(0)
	
	def new_wrap_mode(self, radiobutton, textview, val):
		if radiobutton.get_active():
			textview.set_wrap_mode(val)
	
	def new_justification(self, radiobutton, textview, val):
		if radiobutton.get_active():
			textview.set_justification(val)
	
	def close_application(self, widget):
		gtk.main_quit()
	def __init__(self):
		window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		window.set_resizable(True)
		window.connect("destroy", self.close_application)
		window.set_title("TextView Widget Basic Example")
		window.set_border_width(0)
		
		box1 = gtk.VBox(False, 0)
		window.add(box1)
		box1.show()
		
		box2 = gtk.VBox(False, 10)
		box2.set_border_width(10)
		box1.pack_start(box2, True, True, 0)
		box2.show()
		
		sw = gtk.ScrolledWindow()
		sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
		textview = gtk.TextView()
		textbuffer = textview.get_buffer()
		sw.add(textview)
		sw.show()
		textview.show()
		
		box2.pack_start(sw)
		# Load the file textview-basic.py into the text window
		infile = open("test.py", "r")
		if infile:
			string = infile.read()
			infile.close()
			textbuffer.set_text(string)
	
		hbox = gtk.HButtonBox()
		box2.pack_start(hbox, False, False, 0)
		hbox.show()
		
		vbox = gtk.VBox()
		vbox.show()
		hbox.pack_start(vbox, False, False, 0)
		# check button to toggle editable mode
		check = gtk.CheckButton("Editable")
		vbox.pack_start(check, False, False, 0)
		check.connect("toggled", self.toggle_editable, textview)
		check.set_active(True)
		check.show()
		# check button to toggle cursor visiblity
		check = gtk.CheckButton("Cursor Visible")
		vbox.pack_start(check, False, False, 0)
		check.connect("toggled", self.toggle_cursor_visible, textview)
		check.set_active(True)
		check.show()
		# check button to toggle left margin
		check = gtk.CheckButton("Left Margin")
		vbox.pack_start(check, False, False, 0)
		check.connect("toggled", self.toggle_left_margin, textview)
		check.set_active(False)
		check.show()
		# check button to toggle right margin
		check = gtk.CheckButton("Right Margin")
		vbox.pack_start(check, False, False, 0)
		check.connect("toggled", self.toggle_right_margin, textview)
		check.set_active(False)
		check.show()
		# radio buttons to specify wrap mode
		vbox = gtk.VBox()
		vbox.show()
		hbox.pack_start(vbox, False, False, 0)
		radio = gtk.RadioButton(None, "WRAP__NONE")
		vbox.pack_start(radio, False, True, 0)

		radio.connect("toggled", self.new_wrap_mode, textview, gtk.WRAP_NONE)
		radio.set_active(True)
		radio.show()
		radio = gtk.RadioButton(radio, "WRAP__CHAR")
		vbox.pack_start(radio, False, True, 0)
		
		radio.connect("toggled", self.new_wrap_mode, textview, gtk.WRAP_CHAR)
		radio.show()
		radio = gtk.RadioButton(radio, "WRAP__WORD")
		vbox.pack_start(radio, False, True, 0)	
		radio.show()
		# radio buttons to specify justification
		vbox = gtk.VBox()
		vbox.show()
		hbox.pack_start(vbox, False, False, 0)
		radio = gtk.RadioButton(None, "JUSTIFY__LEFT")
		vbox.pack_start(radio, False, True, 0)
		radio.connect("toggled", self.new_justification, textview,
		gtk.JUSTIFY_LEFT)
		radio.set_active(True)
		radio.show()
		radio = gtk.RadioButton(radio, "JUSTIFY__RIGHT")
		vbox.pack_start(radio, False, True, 0)
		radio.connect("toggled", self.new_justification, textview,
		gtk.JUSTIFY_RIGHT)
		radio.show()
		radio = gtk.RadioButton(radio, "JUSTIFY__CENTER")
		vbox.pack_start(radio, False, True, 0)
		radio.connect("toggled", self.new_justification, textview,
		gtk.JUSTIFY_CENTER)
		radio.show()
		
		separator = gtk.HSeparator()
		box1.pack_start(separator, False, True, 0)
		separator.show()
		
		box2 = gtk.VBox(False, 10)
		box2.set_border_width(10)
		box1.pack_start(box2, False, True, 0)
		box2.show()
		button = gtk.Button("close")
		button.connect_object("clicked", gtk.Widget.destroy,window)
		box2.pack_start(button, True, True, 0)
		button.set_flags(gtk.CAN_DEFAULT)
		button.grab_default()
		button.show()
		window.show()		
def main():
	gtk.main()
	return 0

if __name__ == "__main__":
	TextViewExample()
	main()		

  

?

?

pygtk-TextView


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 国产麻豆高清视频在线第一页 | 欧美美女被爆操 | 波多野结衣绝顶大高潮 | 九九性视频 | 一本色道久久综合亚洲精品高清 | 大伊香蕉精品视频在线天堂 | 久久久噜噜噜久久 | 亚洲日日做天天做日日谢 | 日韩欧美国产成人 | 久久爱avwww久久爱 | 国产一区二区精品久 | 天天射天天干天天色 | 天天干天天操天天做 | 亚洲乱码一区二区三区在线观看 | 亚洲成人国产 | 亚洲国产一区在线二区三区 | 亚洲欧美久久一区二区 | 久久久精品免费国产四虎 | www亚洲欲色成人久久精品 | 亚欧在线精品免费观看一区 | 久久精品23 | 青青成人在线 | 国产成人亚洲精品一区二区在线看 | 色综合成人网 | 7777成年大片免费播放器 | 日韩一级在线视频 | 久久久久青草大香线综合精品 | 免费观看国产网址你懂的 | 九九影院理论片 | 国产精品大全国产精品 | 国产成人精品自拍 | 欧美一级毛片一免费 | 最近中文国语字幕在线播放视频 | 国产精品久久久久毛片 | 成人午夜毛片在线看 | 国产理论视频在线观看 | 免费观看日本污污ww网站一区 | 久久99中文字幕 | 日本一级爽爽爽爽 | 免费的爱爱视频 | 精品视频在线观看一区二区 |