#! /usr/bin/env python
# -*- coding: Latin-1 -*-

# Demo a ScrolledText widget haszn�at�a : 

from Tkinter import *
import Pmw          

def action(event=None):
    """a sz�eg g�get�e a <cel> tag-ig"""
    index = st.tag_nextrange('cel', '0.0', END)
    st.see(index[0])

# Egy ScrolledText widget-et tartalmaz�ablak l�rehoz�a :  
fen = Pmw.initialise()
st = Pmw.ScrolledText(fen,
                      labelpos =N,
                      label_text ="A ScrolledText widget demoja",
                      label_font ='Times 14 bold italic',
                      label_fg = 'navy', label_pady =5,
                      text_font='Helvetica 11 normal', text_bg ='ivory',
                      text_padx =10, text_pady =10, text_wrap ='none', 
                      borderframe =1,
                      borderframe_borderwidth =3,
                      borderframe_relief =SOLID,
                      usehullsize =1,
                      hull_width =370, hull_height =240)
st.pack(expand =YES, fill =BOTH, padx =8, pady =8)

# A tag-ek defin�i�a, <eg�kattint�> esem�y asszoci��a : 
st.tag_configure('cim', foreground ='brown', font ='Helvetica 11 bold italic')
st.tag_configure('link', foreground ='blue', font ='Helvetica 11 bold')
st.tag_configure('cel', foreground ='forest green', font ='Times 11 bold')
st.tag_bind('link', '<Button-3>', action)

cim ="""A r�a � a holl�
�ta Jean de la Fontaine, francia szerz�
\n"""
auteur ="""
Jean de la Fontaine
francia ��(1621-1695)
Verses mes� � mindenek el�t,
1668-t� 1694-ig publik�t �latt�t�etei
 tett� h�ess�"""

# A Text widget kit�t�e (2 technika) :
st.importfile('CorbRenard.txt')
st.insert('0.0', cim, 'cim')
st.insert(END, auteur, 'cel')
# Egy k� beszr�a :
photo =PhotoImage(file= 'penguin.gif')
st.image_create('6.14', image =photo)
# Egy tag hozz�d�a :
st.tag_add('link', '2.4', '2.23')

fen.mainloop()
