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 ? -
-
#!/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()
-
One way is to create a StringVar and assign it to the entry field textvariable option. Use the StringVar object's method set to assign a value. Use a lambda in the browse button command assignment so you can pass the StringVar as an argument for reassignment. You should not need a global variable. -
-
#!/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(var):
-
name = askopenfilename()
-
global pathname
-
pathname = os.path.split(name)[0]
-
print pathname
-
var.set(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)
-
-
value = StringVar()
-
value.set(pathname)
-
e1 = Entry(area, textvariable=value)
-
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=lambda:BrowseButtonClass(value))
-
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()
-
2 1741 bvdet 2,851
Expert Mod 2GB
One way is to create a StringVar and assign it to the entry field textvariable option. Use the StringVar object's method set to assign a value. Use a lambda in the browse button command assignment so you can pass the StringVar as an argument for reassignment. You should not need a global variable. -
-
#!/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(var):
-
name = askopenfilename()
-
global pathname
-
pathname = os.path.split(name)[0]
-
print pathname
-
var.set(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)
-
-
value = StringVar()
-
value.set(pathname)
-
e1 = Entry(area, textvariable=value)
-
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=lambda:BrowseButtonClass(value))
-
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()
-
great work .. thanx.. that was helping
Sign in to post your reply or Sign up for a free account.
Similar topics
by: codecraig |
last post by:
Hi,
I am using Tkinter and I have a Label and a Scale. I want to update
my label everytime the Scale value changes. What is the best way of
doing this? Do i have to bind for every event type? ...
|
by: kaiser |
last post by:
Hello, Am new to C# and am playing around trying to get a while loop to
display a int on a windows console using label.
private void btnGo_Click(object sender, System.EventArgs e)
{
int Counter...
|
by: David-L. Nadeau |
last post by:
Hi !
I have a little problem. I have a process that runs when a user click a
button. The process is long to execute (+/- 5 minutes). So, I put a progress
bar and now I want to show the evolution...
|
by: Mike Johnson |
last post by:
Thanks for the quick responses. I'm having trouble understanding. I've
included the code I using. perhaps someone can tell me what I'm doing wrong.
My original question was,
I'm new to VB.Net...
|
by: Hexman |
last post by:
In my program I have several labels that I want to update with
information that is being processed in a calculation module. I have
code similar to the following in my module. As it goes through...
|
by: Ryan |
last post by:
I've got a little bit of code that runs when you enter data in a
datasheet view (which is a subform of the form you are in)
if rst!DateReceived >= 30 Then
Forms!DisposalRecords.Label90.Caption =...
|
by: yoavkarmon |
last post by:
private void domainUpDown1_SelectedItemChanged(object sender, EventArgs e)
{
Label labeli = new Label;
for (int i = 0; i < 2; i++)
{
...
|
by: dipak000 |
last post by:
Hi,
I have a non form class. I want to update label/ check status of check box etc.. in non form class ( here resides functions that contains logic). How can i do that ?
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |