Python - How to load a file and convert it base64

This python script creates a window with four buttons, two labels and a text widget. The code is fairly good commented and speaks for itself. The coded file will be written as a text file.

import Tkinter, Tkconstants, tkFileDialog
from Tkinter import *
import tkMessageBox
import base64
import webbrowser

def exit():
    window.quit()

def about():
    tkMessageBox.showinfo("Image Encoder","This program converts an image to base64.\nCurrent version is 0.1a")

def select_file():
    text.delete('1.0', END)
    text.update()
    selectedFile = tkFileDialog.askopenfilename( filetypes = ( ("JPG files", "*.jpg"),("PNG files", "*.png"),
                                                               ("GIF files", "*.gif"),("Alle Files","*") ) )
    lblSelectedFileLabel = Label(window, text=selectedFile, font=("Arial", 12))
    lblSelectedFileLabel.place(x=0, y=90)

    with open(selectedFile, "rb") as image_file:
        encoded_string = base64.b64encode(image_file.read())
        text.insert(INSERT, encoded_string)

        webbrowser.open(selectedFile)

        fh = open("imgEncode.txt", "w")
        fh.write(encoded_string)
        fh.close()

    #For debugging
    print (selectedFile)
    print (encoded_string)

def clear_text():
    text.delete('1.0', END)
    text.update() 

#Create the working window
window = Tk()
window.title("Image encoder")
window.geometry("640x480+0+0")
window.resizable(False, False)

#BUTTONS   
#Create and place Exit button
btnExit = Button(window, text="Exit", width=10, command=exit)
btnExit.place(x=0, y=0)

#Create and place About button
btnAbout = Button(window, text="About", width=10, command=about)
btnAbout.place(x=110, y=0)

#Create and place Select File button
btnSelectFile = Button(window, text="Select File", width=10, command=select_file)
btnSelectFile.place(x=0, y=30)

#Create and place Clear button
btnSelectFile = Button(window, text="Clear", width=10, command=clear_text)
btnSelectFile.place(x=110, y=30)

#TEXT AND LABELS
#Create and place the selected file labels
lblFileTxt = Label(window, text="You've selected this file:", font=("Arial", 12))
lblFileTxt.place(x=0, y=60)

#Create and place a text area
text = Text(window, height=25, width=90)
text.place(x=0, y=120)

window.mainloop()

blogroll

social