From 00cf366afeafd34af22b32aaa80513294e705ae5 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 12 Nov 2009 21:31:27 +0100 Subject: [PATCH] Add example code for scrolling widget --- src/panucci/widgets.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/panucci/widgets.py b/src/panucci/widgets.py index e88ed6e..ab714c5 100644 --- a/src/panucci/widgets.py +++ b/src/panucci/widgets.py @@ -396,4 +396,25 @@ class ScrollingLabel(gtk.DrawingArea): """ Make the text stop scrolling """ self.__scrolling = False self.__scrolling_timer = None - + + +if __name__ == '__main__': + w = gtk.Window() + w.set_geometry_hints(w, 100, 20) + hb = gtk.HBox(homogeneous=True, spacing=1) + w.add(hb) + + # scroll 7 pixels per 0.2 seconds, wait halfway for 0.5 seconds and finally + # wait 2 seconds after a complete scroll. wash, rinse, repeat. + l = ScrollingLabel('N/A', 200, 7, 2000, 500) + l.markup = 'some random text 1234' + hb.pack_end(l) + + btn = gtk.Button('start/stop') + hb.pack_start(btn) + btn.connect('clicked', lambda w,e: setattr(e,'scrolling', not e.scrolling), l) + + w.connect('destroy', gtk.main_quit) + w.show_all() + gtk.main() + -- 2.11.4.GIT