I wrote a code and wanna update the PATHNAME for E1.
The Print show's that the Pathname is updating,
but the LabelField is not updating.
What i am doing wrong ?
The Print show's that the Pathname is updating,
but the LabelField is not updating.
What i am doing wrong ?
Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
# http://zetcode.com/gui/tkinter/layout/
# http://docs.activestate.com/komodo/3.5/komodo-doc-guibuilder.html
# http://sebsauvage.net/python/gui/
from Tkinter import *
from tkMessageBox import *
from tkFileDialog import *
from ttk import *
global pathname
pathname ="pathnamevariabl"
import os
def answer():
showerror("Answer", "Sorry, no answer available")
def CloseButtonClass():
quit()
def BrowseButtonClass():
name = askopenfilename()
global pathname
pathname = os.path.split(name)[0]
print pathname
# versuch nach dem browser das script zu starten mit dem parameter des folders
# os.system('upload_with_authentication.py pathname')
def HelpButtonClass():
showwarning('Help', 'Not yet implemented')
def GoButtonClass():
showwarning('Go', 'Not yet implemented')
class MapillaryGui(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Mapillary Upload GUI")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
self.columnconfigure(1, weight=1)
self.columnconfigure(3, pad=7)
self.rowconfigure(3, weight=1)
self.rowconfigure(5, pad=7)
lbl = Label(self, text="Folder")
lbl.grid(sticky=W, pady=4, padx=5)
#das weisse Feld - old code
#area = Text(self)
area = Text(self)
Label(area, text="Threat 1 : ").grid(row=0)
Label(area, text="Threat 2 : ").grid(row=1)
e1 = Entry(area)
e2 = Entry(area)
e1.grid(row=0, column=1)
e2.grid(row=1, column=1)
e1.insert(10,pathname)
area.grid(row=1, column=0, columnspan=2, rowspan=4,
padx=5, sticky=E+W+S+N)
# Button Browse
abtn = Button(self, text="Browse", command=BrowseButtonClass)
abtn.grid(row=1, column=3)
#Button Close
cbtn = Button(self, text="Close", command=CloseButtonClass)
cbtn.grid(row=2, column=3, pady=4)
#Button Help
hbtn = Button(self, text="Help", command=HelpButtonClass)
hbtn.grid(row=5, column=0, padx=5)
#Button Go
obtn = Button(self, text="GO", command=GoButtonClass)
obtn.grid(row=5, column=3)
def main():
root = Tk()
root.geometry("300x200+300+300")
app = MapillaryGui(root)
root.mainloop()
if __name__ == '__main__':
main()
Comment