ScriptEditorV3: A Tkinter GUI
Python Application
Geography 565 – Python Programming - Summer 2017
Final Class Project
John Marshall
A ‘Cat’, ‘Bat’, ‘Mat’
Philosophy to Code
Development
Project Goal
ScriptEditor is designed to help developers edit
their Python scripts during application
development.
Tkinter Module
Tkinter is a version of Tk code (used to
develop GUIs) specifically designed for use in
Python 2. It allows developers to import a
comprehensive list of modules useful for
creating GUI controls such as labels, text
boxes, buttons, etc.
Tkinter Syntax
from Tkinter import *
root = Tk()
myApp = myClassConstructor
[Link]()
Python Method to
GUI
#Method that when called allows
script/text from a selected file to be
loaded into a text window
def load(self):
[Link] = [Link]()
[Link](1.0, END)
if [Link]:
[Link](1.0, [Link]())
filemenu.add_command(label="Load
Script to Copy and
Edit",command=[Link])
Python Method to
GUI
#Method that when called allows
script/text from a selected file to be
loaded into a text window
def load(self):
[Link] = [Link]()
[Link](1.0, END)
if [Link]:
[Link](1.0, [Link]())
filemenu.add_command(label="Load
Script to Copy and
Edit",command=[Link])
Python Method to
GUI
#Method that when called allows
script/text from a selected file to be
loaded into a text window
def load(self):
[Link] = [Link]()
[Link](1.0, END)
if [Link]:
[Link](1.0, [Link]())
filemenu.add_command(label="Load
Script to Copy and
Edit",command=[Link])
Python Method to
GUI
#Method that when called allows a
selected file to be saved in a file
directory
def saveas(self):
[Link] = [Link]()
if [Link]:
[Link]([Link](1.0,
END))
filemenu.add_command(label="Save
Script as",command=[Link])
Python Method to
GUI
#Method that when called allows a
selected file to be saved in a file
directory
def saveas(self):
[Link] = [Link]()
if [Link]:
[Link]([Link](1.0,
END))
filemenu.add_command(label="Save
Script as",command=[Link])
Python Method to
GUI
#Method that when called allows
execution (run) of a file
def callback(self):
[Link] =
[Link]()
if [Link]:
execfile([Link])
filemenu.add_command(label="Run
Python File",command=[Link])
Python Method to
GUI
#Method that when called allows
execution (run) of a file
def callback(self):
[Link] =
[Link]()
if [Link]:
execfile([Link])
filemenu.add_command(label="Run
Python File",command=[Link])
Python Method
to GUI
#Method that when called
allows execution (run) of a file
def callback(self):
[Link] =
[Link]()
if [Link]:
execfile([Link])
filemenu.add_command(label="
Run Python
File",command=[Link])
ScriptEditorV3 with Python IDE
Python Script to Executable
Standalone Application
➢ Reviewed documentation for ‘PyInstaller’
➢ Found Python installation folder on my ‘C’ drive and
navigated to the ‘Scripts’ folder (e.g.,
C:\Python27\ArcGIS10.4\Scripts).
➢ Opened my command prompt in computers with Windows
10 OS and right clicked on windows icon, selected Run,
and entered ‘cmd’ into open textbox.
Python Script to Executable
Standalone Application
➢ In command line, entered ‘cd’ to change directory then copied and
pasted (e.g., <control> C, <control> V) the directory path to the
‘Scripts’ folder after ‘cd’ and selected ‘Enter’ (e.g., cd
C:\Python27\ArcGIS10.4\ Scripts <Enter>).
➢ In new directory, I entered ‘pip install pyinstaller’ (e.g.,
C:\Python27\ ArcGIS10.4\Scripts> pip install pyinstaller<Enter>). I
made sure I was connected to the internet to enable pip to find and
install pyinstaller. It took a few seconds for the installation to
complete. Once completed I observed the installed new files in my
‘Scripts’ folder.
Python Script to Executable
Standalone Application
➢ I navigated back to my command window and made sure it was still
using the ‘Scripts’ directory (e.g., ‘C:\Python27\ArcGIS10.4\
Scripts>’). Then I entered: [Link] - -onefile and the
directory path to my Python script ([Link]) to create a
standalone executable application (e.g., C:\Python27\ ArcGIS10.4\
Scripts> [Link] –onefile C:\EsriPress\Python\ Data\
Exercise13\ [Link]<Enter>).
➢ Once the procedure completed running, the last line of the run
output indicated where my execution file had been placed (e.g.,
C:\Python27\ArcGIS10.4 \ Scripts\dist\[Link]).
[Link]
DESKTOP SHORTCUT
[Link]
DESKTOP SHORTCUT
[Link] Script, Standalone
Execution File, and Documentation
[Link]
[Link]