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: Image to Label Maryan 10 469 Oct-29-2020, 01:48 PM
Last Post: joe_momma
  Tkinter - How can I extend a label widget? TurboC 2 295 Oct-13-2020, 12:15 PM
Last Post: zazas321
  Tkinter: How to assign calculated value to a Label LoneStar 7 463 Sep-03-2020, 08:19 PM
Last Post: LoneStar
  changing tkinter label from thread nanok66 3 846 Jun-07-2020, 01:37 AM
Last Post: nanok66
  Make Label Text background (default color) transparent using tkinter in python barry76 1 9,758 Nov-28-2019, 10:19 AM
Last Post: Larz60+
  Spacing Between two labels are very far and Top label is not in Center using Tkinter barry76 2 1,931 Jul-30-2019, 10:49 AM
Last Post: wuf
  Unable to update or refresh label text in tkinter jenkins43 3 2,888 Jul-24-2019, 02:09 PM
Last Post: Friend
  tkinter label error nonzzo 1 1,666 Mar-31-2019, 01:29 PM
Last Post: Larz60+
  [Tkinter] TkInter toggle Label on/off MTom5 2 2,977 Aug-15-2018, 12:35 AM
Last Post: metulburr
  printing option menu variable in label in Tkinter SmokerX 1 3,801 Jan-18-2018, 07:36 PM
Last Post: SmokerX

Forum Jump:

User Panel Messages

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