ó «‡Uc@ssdZddlZejdƒddlZddlZdejfd„ƒYZd„ZedkroeƒndS(s¢Text Widget/Automatic scrolling This example demonstrates how to use the gravity of GtkTextMarks to keep a text view scrolled to the bottom while appending text.iÿÿÿÿNs2.0tAutomaticScrollingDemocBs8eZdd„Zd„Zd„Zd„Zd„ZRS(cCsÝtjj|ƒy|j|jƒƒWn$tk rM|jdd„ƒnX|j|jj ƒ|j ddƒ|j dƒtj t dƒ}|j|ƒ|j|t ƒ|j|tƒd|_d|_|jƒdS(NtdestroycWs tjƒS(N(tgtkt main_quit(tw((s(/usr/lib/pygtk27/2.0/demos/textscroll.pytsiXiii(RtWindowt__init__t set_screent get_screentAttributeErrortconnectt set_titlet __class__t__name__tset_default_sizetset_border_widthtHBoxtTruetaddtcreate_text_viewtFalsetcount_sbtcount_setshow_all(tselftparentthbox((s(/usr/lib/pygtk27/2.0/demos/textscroll.pyRs     csatjƒ}|j|ƒtjƒ}|j|ƒ|j||ƒ‰|jd‡fd†ƒdS(NRcs tjˆƒS(N(tgobjectt source_remove(twidget(ttimeout(s(/usr/lib/pygtk27/2.0/demos/textscroll.pyR.s(RtScrolledWindowt pack_starttTextViewRt setup_scrollR (RRt scroll_to_endtswindowttextview((Rs(/usr/lib/pygtk27/2.0/demos/textscroll.pyR$s     cCst|jƒ}|jƒ}|rG|jd|tƒtjd|j|ƒS|jd|tƒtjd|j|ƒSdS(Ntendi2tscrollid( t get_buffert get_end_itert create_markRRt timeout_addR$Rtscroll_to_bottom(RR&R$tbuftitr((s(/usr/lib/pygtk27/2.0/demos/textscroll.pyR#0s  cCsœ|jƒ}|jdƒ}|j|ƒ}|j|dƒ|j|d|jƒ|j|dƒ|j|ƒ|jd7_|jdkr˜d|_ntS(NR's t s8Scroll to end scroll to end scroll to end scroll to end ii–i(R)tget_marktget_iter_at_marktinsertRtscroll_mark_onscreenR(RR&R.tmarkR/((s(/usr/lib/pygtk27/2.0/demos/textscroll.pyR$Is   cCs¶|jƒ}|jƒ}|j|dƒ|j|d|jƒ|j|dƒ|jdƒ|jdƒ}|j||ƒ|j|ƒ|jd7_|jdkr²d|_ntS(Ns R0sCScroll to bottom scroll to bottom scroll to bottom scroll to bottomiR(ii(( R)R*R3Rtset_line_offsetR1t move_markR4R(RR&R.R/R5((s(/usr/lib/pygtk27/2.0/demos/textscroll.pyR-cs     N(Rt __module__tNoneRRR#R$R-(((s(/usr/lib/pygtk27/2.0/demos/textscroll.pyR s    cCstƒtjƒdS(N(RRtmain(((s(/usr/lib/pygtk27/2.0/demos/textscroll.pyR:‚st__main__( t__doc__tpygtktrequireRRRRR:R(((s(/usr/lib/pygtk27/2.0/demos/textscroll.pyts    u