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?
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


import os
from tkinter import *
from tkinter import ttk
from tkinter import filedialog
root = Tk()
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
print(path) # PATH EXCEL
def read_excel():
    return path # FilePaht
def start_app():
    print('app running')
    os.system('python ..\\Tests\\')

I need to pass label FilePaht to another module called

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter destroy label inside labelFrame Nick_tkinter 2 1,285 Feb-24-2021, 03:31 AM
Last Post: deanhystad
  tkinter: Image to Label Maryan 10 1,751 Oct-29-2020, 01:48 PM
Last Post: joe_momma
  Tkinter - How can I extend a label widget? TurboC 2 982 Oct-13-2020, 12:15 PM
Last Post: zazas321
  Tkinter: How to assign calculated value to a Label LoneStar 7 1,174 Sep-03-2020, 08:19 PM
Last Post: LoneStar
  changing tkinter label from thread nanok66 3 2,739 Jun-07-2020, 01:37 AM
Last Post: nanok66
  Make Label Text background (default color) transparent using tkinter in python barry76 1 14,904 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 3,779 Jul-30-2019, 10:49 AM
Last Post: wuf
  Unable to update or refresh label text in tkinter jenkins43 3 3,937 Jul-24-2019, 02:09 PM
Last Post: Friend
  tkinter label error nonzzo 1 2,227 Mar-31-2019, 01:29 PM
Last Post: Larz60+
  [Tkinter] TkInter toggle Label on/off MTom5 2 3,711 Aug-15-2018, 12:35 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

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