Since I couldn't find a suitable solution or useful ideas in previous threads, I'll try asking directly instead.
I am working on a script that downloads and processes geodata in python 2.7. my main code works fine, but since different employer(s) should be able to use my tool, I need a proper interface. I don't want to use pyQt because afaik it must be installed separately and cannot be used by simply importing the .py-file.
So I started out using tkinter.
Right now, my tool can be controlled by a simple gui, that allows the user to enter or alter three text-variables, click start and quit buttons, and read a status bar with (for now) static text.
So if the user hits the start button the main process (where all the downloading and converting work is done) starts.
What I want to do now, is modifying the static status bar with progress updates like "downloading file 10 of 20" or "converting file 11 to feature class / shapefile"
I am not too familiar with tkinter or any kind of gui's yet, so I'll need some advice on how to structure my code with regard to tkinter.
import os
import urllib
import arcpy
from Tkinter import *
def start():
mainpath= e0.get()
if not os.path.exists(mainpath+"\\subfolder\\a1"):
os.makedirs(mainpath+"\\subfolder\\a1")
os.makedirs(mainpath+"\\subfolder\\a2")
os.makedirs(mainpath+"\\subfolder\\a3")
os.makedirs(mainpath+"\\subfolder\\a4")
else:
print "folder a1 already exists"
DOWNLOADS_DIR = mainpath + "\\subfolder\\a3"
targetsite= e1.get()
searchstring= e2.get()
######################################
#now here the downloading and processing is done
#for example:
if not os.path.isfile(filename):
print "starting download "+element
urllib.urlretrieve(element, filename)
# I want to return a status like below to the status bar in the GUI
status_string = 'downloading file ' + str(i)+ ' from' + str(count)
status.set(status_string)
######################################
master = Tk()
Label(master, text="working directory: ").grid(row=0)
Label(master, text="URL: ").grid(row=1)
Label(master, text="searchstring: ").grid(row=2)
mainpathstring = StringVar(master, value='D:\project')
e0 = Entry(master, textvariable=mainpathstring, width="50")
linkstring = StringVar(master, value='http://thedefaultwebsite.com')
e1 = Entry(master, textvariable=linkstring, width="50")
searchstring = StringVar(master, value='coordinates')
e2 = Entry(master, textvariable=searchstring, width="50")
e0.grid(row=0, column=1)
e1.grid(row=1, column=1)
e2.grid(row=2, column=1)
Button(master, text='quit', command=master.quit).grid(row=3, column=0, sticky=W, pady=4)
Button(master, text='start', command=start).grid(row=3, column=1, sticky=W, pady=4)
status= Label(master, text="working on: nothing", bd=1, relief=SUNKEN, anchor=W).grid(row=4, column=0, columnspan=3)
mainloop( )
How should this be approached? Where can I find good examples to toy with?