[pygtk] gtk.TextView changing size.

Yuri Pimenov yuri.pimenov at gmail.com
Wed Nov 7 18:29:53 WST 2007


1. use gtk.POLICY_AUTOMATIC for horizontal scrolling
or
2. scrolledwindow.set_size_request(width, -1)

On 07/11/2007, Neil Dugan <pygtk �� butterflystitches.com.au> wrote:
> 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 ---------------------
> _______________________________________________
> pygtk mailing list   pygtk �� daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>


-- 
Yuri Pimenov


More information about the pygtk mailing list