connecting to signals
- From: Brian <dol-sen telus net>
- To: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: connecting to signals
- Date: Mon, 29 Mar 2004 23:47:47 -0800
I seem to be having problems connecting to signals
I am trying to connect to a scrolled window and get a scroll event to
run my function. Here is some code from an example program I was
adding to.
def scroll(self, widget):
print >>stderr, "got it"
def __init__(self):
# Create a new dialog window for the scrolled window to be
# packed into.
window = gtk.Dialog()
window.connect("destroy", self.destroy)
window.set_title("ScrolledWindow example")
window.set_border_width(0)
window.set_size_request(300, 300)
# create a new scrolled window.
scrolled_window = gtk.ScrolledWindow()
scrolled_window.set_border_width(10)
# the policy is one of POLICY AUTOMATIC, or POLICY_ALWAYS.
# POLICY_AUTOMATIC will automatically decide whether you need
# scrollbars, whereas POLICY_ALWAYS will always leave the
scrollbars
# there. The first one is the horizontal scrollbar, the second,
the
# vertical.
scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_ALWAYS)
hadjustment = gtk.Adjustment
vadjustment = scrolled_window.get_vadjustment()
id = scrolled_window.connect("scroll-child", self.scroll)
print >>stderr, "id"
print >>stderr, id
# The dialog window is created with a vbox packed into it.
window.vbox.pack_start(scrolled_window, gtk.TRUE, gtk.TRUE, 0)
scrolled_window.show()
I have tried connecting to several signals from scrolled windows,
textviews and never receive the signal when any scrollbar is moved.
Any idea what I may be doing wrong?
--
Brian <dol-sen telus net>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]