[pygtk] gtk.TextView changing size.

Neil Dugan pygtk at butterflystitches.com.au
Wed Nov 7 13:32:41 WST 2007


Hi,


When you type in the one of the textview widgets in the app. below the 
size of the textview changes.  I would like to stop this.


-------------- cut ---------------------
#!/usr/bin/env python

import gtk

class window():
	def __init__(self):
		window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		window.set_border_width(10)
		window.set_default_size(400,300)
		window.connect("destroy", lambda wid: gtk.main_quit())
		window.connect("delete_event", lambda a1,a2:gtk.main_quit())
		
		hbox = gtk.HBox()
		window.add(hbox)
		hbox.add(self.create_textview())
		hbox.add(self.create_textview())
		window.show_all()

	def create_textview(self) :
		scrolledwindow = gtk.ScrolledWindow()
		scrolledwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
		textview = gtk.TextView()
		scrolledwindow.add(textview)
		textview.set_wrap_mode(gtk.WRAP_WORD)
		return scrolledwindow

	def main(self):
	    gtk.main()
	    return 0

if __name__ == "__main__":
	test = window()
	test.main()
-------------- cut ---------------------


More information about the pygtk mailing list