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

loadfile.py

#! /usr/local/bin/python

# last updated 29-Jul-2008 -- dmreagan

import filedlg
from Tkinter import *

class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)


        self.button = Button(self)
        self.button['text'] = 'Load File...'
        self.button['command'] = self.Press
        self.button.pack({"side": "top"})

        self.pack()

    def Press(self):
        fileDlg = filedlg.LoadFileDialog(app, "Load File", "*")
        if fileDlg.Show() != 1:
            fileDlg.DialogCleanup()
            return
        fname = fileDlg.GetFileName()
        self.button['text'] = 'File: ' + fname
        fileDlg.DialogCleanup()


app = Application()
app.mainloop()
by AMcneil last modified Feb 29, 2016 12:25 PM