#!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-

##############################################################################
# Python script
# Author: Matthias Kievernagel
# File: editModified.py
# Date: 24.01.2007
# Description:
#   Testing Text.edit_modified() and friends.
# 
# 
##############################################################################


from Tkinter import *
import traceback

def dump():
    res = t.edit_modified()
    print 't.edit_modified()', res, type(res)

def setTrue():
    print 't.edit_modified(True)', t.edit_modified(True)
def setFalse():
    print 't.edit_modified(False)', t.edit_modified(False)

def doRedo():
    try:
        t.edit_redo()
    except:
        print 'Catched--------------------------------'
        traceback.print_exc()
def doReset():
    t.edit_reset()
def doSep():
    t.edit_separator()
def doUndo():
    try:
        t.edit_undo()
    except:
        print 'Catched--------------------------------'
        traceback.print_exc()


r = Tk()
t = Text(r, undo=YES)
t.pack()
f = Frame(r)
f.pack()
b = Button(f, text='modified?', command=dump)
b.pack(side=LEFT)

b = Button(f, text='set TRUE', command=setTrue)
b.pack(side=LEFT)
b = Button(f, text='set FALSE', command=setFalse)
b.pack(side=LEFT)

b = Button(f, text='redo', command=doRedo)
b.pack(side=LEFT)
b = Button(f, text='reset', command=doReset)
b.pack(side=LEFT)
b = Button(f, text='separator', command=doSep)
b.pack(side=LEFT)
b = Button(f, text='undo', command=doUndo)
b.pack(side=LEFT)


r.mainloop()
