[pygtk] how to get a handler list for a signal?
Charles D Hixson
charleshixsn at earthlink.net
Fri Jun 2 04:17:57 WST 2006
Sandro Dentella wrote:
> > On Thu, Jun 01, 2006 at 01:38:06AM -0700, Charles D Hixson wrote:
> >
>
>> >> I'm trying to place a textview into a scrolled window (inside of either
>> >> an HBox or a Table), and running into the problem that the window is
>> >> unreasonably narrow. Even if I attach it into a Table and tell the
>> >> table.attach(sw, 1, 6, 0, 4) while the pane is sufficiently wide, the
>> >> text entered in that pane is about 8-10 characters wide...then it will
>> >>
>>
> >
> >
>
>> >> I'd include the code, but it's a bit verbose for a mailing list for even
>> >> a simple case. Also, I've tried several different things, and detailing
>> >> that....
>> >>
>>
> >
> > Can't you try and create a simple example of the problem you have? I
> > personally find it really difficult to help you w/o a code to read even
> > thouht I don't normally have problems w/ TextView dimentions...
> >
> > *:-)
>
Understood. Well, I can boil it down THIS far:
------------------------------------------------------------------------
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
class GuiWindow:
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
#window = self.window ## **!!** delete this later
self.window.set_name ("Test Input")
# build the button bar
vbox2 = gtk.VBox()
#self.table.attach(vbox, 0, 1, 0, 3)
# .. A Run button
self.runButton = gtk.Button("Run")
vbox2.pack_start(self.runButton, expand = False, fill = False, padding = 0)
self.runButton.show()
# .. A Reset button
self.resetButton = gtk.Button("Reset")
self.resetButton.show()
# .. And a quit button
button = gtk.Button("Quit")
vbox2.pack_end(button, expand = False, fill = True, padding = 0)
button.connect_object("clicked", lambda w: w.destroy(), self.window)
button.show()
hbox = gtk.HBox()
hbox.pack_start (vbox2, expand = True, fill = True, padding = 0)
sw = gtk.ScrolledWindow()
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
textview = gtk.TextView()
#textview.set_wrap_mode(gtk.WRAP_WORD)
self.textbuffer = textview.get_buffer()
sw.add(textview)
sw.show()
#self.table.attach(sw, 1, 6, 0, 4)
vboxsw = gtk.VBox()
hbox.pack_start (vboxsw, expand = True, fill = True, padding = 0)
vboxsw.pack_start (sw, expand = True, fill = True, padding = 0)
textview.show()
self.textbuffer.set_text("This is a bunch of stuff entered as initial contents")
# Create the drawing area
drawing_area = gtk.DrawingArea()
drawing_area.set_size_request(200, 200)
hbox.pack_start (drawing_area, expand = True, fill = True, padding = 0)
vbox1 = gtk.VBox()
vbox1.pack_start (hbox, expand = True, fill = True, padding = 0)
hbox.show()
self.window.connect("destroy", lambda w: gtk.main_quit())
drawing_area.show()
self.window.add(vbox1)
vbox1.show()
self.window.show_all()
def main(self):
gtk.main()
return 0
if __name__ == "__main__":
g = GuiWindow()
g.main()
More information about the pygtk
mailing list