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 1742 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: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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: 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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |