You are here: Home / Community / Workshops / 2008 - Fribourg / Content / Shakespeare / Effect / bin / interp / interpDlg.py

interpDlg.py

# last updated 29-Jul-2008 -- dmreagan

from Tkinter import *


class interpDlg:
    def __init__(self, path, family):

        top = Toplevel()

        self.addTitle(top)
        f1 = Frame(top, borderwidth=5)
        f2 = Frame(top, borderwidth=5)
        f1.pack(anchor=S, expand=YES, fill=X)
        f2.pack(anchor=N, expand=YES, fill=X)

        self.addLabels(f1,f2)

        button = Button(top, text='OK', command=top.destroy)
        button.pack(side=BOTTOM)

        e1 = Entry(f1,relief=SUNKEN, textvariable=path,
                      width=len(path.get()))
        e2 = Entry(f2, relief=SUNKEN, textvariable=family,
                   width=len(path.get()))
        e2.selection_to(END)
        e2.selection_to(END)
        e1.pack(side=RIGHT, expand=YES, fill=X)
        e2.pack(side=RIGHT, expand=YES, fill=X)

        top.grab_set()
        top.focus_set()
        top.wait_window()

    def addTitle(self,top):
        top.title("Base Class")
    def addLabels(self, frame1, frame2):
        Label(frame1,text='Base Class',
              width=len('Specify instrument family.')).pack(side=LEFT)
        Label(frame2,text='BaseClass.',
              width=len('Specify instrument family.')).pack(side=LEFT)

class PathDialog:
    def __init__(self,path):
        top = Toplevel()
        top.title("Family Path")

        f1 = Frame(top, borderwidth=10)
        f1.pack(anchor=S, expand=YES, fill=X)
        Label(f1,text='Please check the Family path:',
              width=len('Please check the Family path:')).pack(side=LEFT)
        button = Button(top, text='OK', command=top.destroy)
        button.pack(side=BOTTOM)
        e1 = Entry(f1,relief=SUNKEN, textvariable=path,
                      width=len(path.get()))
        e1.pack(side=RIGHT, expand=YES, fill=X)
        top.grab_set()
        top.focus_set()
        top.wait_window()


class NewDialog (interpDlg):
    def __init__(self, path, family):
        interpDlg.__init__(self, path, family)

    def addTitle(self,top):
        top.title("Family Specifier")
    def addLabels(self, frame1, frame2):
        Label(frame1,text='Specify family path.',
                  width=len('Specify instrument family.')).pack(side=LEFT)
        Label(frame2,text='Specify instrument family.',
                  width=len('Specify instrument family.')).pack(side=LEFT)

class SaveDialog(interpDlg):
    def __init__(self, path, family):
        interpDlg.__init__(self, path, family)

    def addTitle(self,top):
        top.title("Save Dialog")
    def addLabels(self, frame1, frame2):
        Label(frame1,text='family path.',
                  width=len('Specify instrument path.')).pack(side=LEFT)
        Label(frame2,text='Output file.',
                  width=len('Specify instrument path.')).pack(side=LEFT)
by AMcneil last modified Feb 29, 2016 12:25 PM