Python Forum
[Tkinter] tkinter How to pass label fiilename to another module?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] tkinter How to pass label fiilename to another module?
#1
This is work fine if I pass entry but I don't understand how to do it in label filename.
this is same example to pass entry to another function https://www.raspberrypi.org/forums/viewt...p?t=195973:

File GUI.py


import os
from tkinter import *
from tkinter import ttk
from tkinter import filedialog
 
root = Tk()
root.title("Fisrt")
ttk.Label(root, text="Add Excel File :").grid(row=0, column=0, padx=20, pady=20)
open_file = ttk.Button(root, text="Open files")
open_file.grid(row=0, column=1, columnspan=2, padx=20, pady=20)
ttk.Label(root, text="Name Excel :").grid(row=1, column=0, padx=20, pady=20)
box_red_path = ttk.Label(root, text="")
box_red_path.grid(row=1, column=1, columnspan=4, padx=20, pady=20)
stare_scripte = ttk.Button(root, text="Start")
stare_scripte.grid(row=3, column=2, columnspan=2, padx=20, pady=20)
 
def upload_excel():
    global path
    filename = filedialog.askopenfilename(title="Select a File", filetype=(("Excel", "*.xlsx"), ("Excel", "*.xls")))
 
 
path = filename
box_red_path.configure(text=path)
print(path) # PATH EXCEL
 
open_file.config(command=upload_excel)
 
def read_excel():
    return path # FilePaht
 
def start_app():
    print('app running')
    os.system('python ..\\Tests\\AllTests.py')
 
stare_scripte.config(command=start_app)
 
root.mainloop()
--------------

I need to pass label FilePaht to another module called Excel.py
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter: An image and label are not appearing. emont 7 565 Mar-21-2024, 03:00 PM
Last Post: deanhystad
  pass a variable between tkinter and toplevel windows janeik 10 2,321 Jan-24-2024, 06:44 AM
Last Post: Liliana
  tkinter destroy label inside labelFrame Nick_tkinter 3 4,541 Sep-17-2023, 03:38 PM
Last Post: munirashraf9821
Lightbulb [Tkinter] Tkinter Class Import Module Issue AaronCatolico1 6 3,096 Sep-06-2022, 03:37 PM
Last Post: AaronCatolico1
  [Tkinter] Updating Tkinter label using multiprocessing Agusms 6 3,127 Aug-15-2022, 07:10 PM
Last Post: menator01
  [Tkinter] The Text in the Label widget Tkinter cuts off the Long text in the view malmustafa 4 4,830 Jun-26-2022, 06:26 PM
Last Post: menator01
  how to add two numbers and pass the result to the next page in tkinter? pymn 7 4,332 Feb-15-2022, 04:40 AM
Last Post: pymn
  [Tkinter] tkinter best way to pass parameters to a function Pedroski55 3 4,832 Nov-17-2021, 03:21 AM
Last Post: deanhystad
  tkinter: Image to Label Maryan 10 5,235 Oct-29-2020, 01:48 PM
Last Post: joe_momma
  Tkinter - How can I extend a label widget? TurboC 2 2,773 Oct-13-2020, 12:15 PM
Last Post: zazas321

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020