Python Forum
[Tkinter] Python - Tkinter : How can I send path Excel from GUI to scripte
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Python - Tkinter : How can I send path Excel from GUI to scripte
#1
Hello Guys I have a script and Now I'm Build Interface in that script:

The Script work by data from Excel:

After upload and click start : I need to send Path Excel to Script meaning to another module have name data.py:

this is my code of GUI Interface Build By Tkinter:

import os
from tkinter import *
from tkinter import ttk
from tkinter import filedialog

root = Tk()
root.title("GUI")
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():

    filename = filedialog.askopenfilename(title="Select a File", filetype=(("Excel", "*.xlsx"), ("Excel", "*.xls")))

    path = filename

    box_red_path.configure(text=path)
open_file.config(command=upload_excel)

def start_app():
    print('app running')

stare_scripte.config(command=start_app)
root.mainloop()
This is my Interface: [Image: DEq2C.png]
Reply
#2
The best way (in my opinion) is to contain it all in a class.
then you can expose any variables you wish to other applications that you wish.
I have an example here (large app, but concepts same for small one): https://python-forum.io/Thread-Show-Inst...ht=tkinter
or this simple one: https://python-forum.io/Thread-Show-all-...ht=tkinter
Reply
#3
johnjh Good job.

I`m beginner in Python, could you please help to adopt the script above and add my df:

df = pd.read_excel(GET EXCEL FILE, header=0, usecols = 'A, B, C', skiprows = 2) 
GET EXCEL FILE = File from Tkinter.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [TKINTER] Problems creating directories in a selected path Vulera 2 2,728 Aug-10-2021, 06:38 PM
Last Post: Vulera
  [Tkinter] Override the paste function(copy from excel file - paste in separate tkinter entryes) AndreiV 3 4,557 Jun-05-2020, 04:46 PM
Last Post: AndreiV
  tkinter.TclError: bad window path name kenwatts275 3 14,631 Apr-26-2020, 08:16 PM
Last Post: kenwatts275
  [Tkinter] Tkinter - I need to read file excel from GUI app to script file johnjh 0 10,671 Apr-17-2020, 08:14 PM
Last Post: johnjh
  How can a user send a message via Contact Form in tkinter karolp 0 2,318 Apr-08-2020, 08:00 PM
Last Post: karolp
  [Tkinter] Help me,send message via tkinter chano 2 2,429 May-15-2019, 08:59 AM
Last Post: chano
  Append Data from TkInter to Excel zinho 5 18,852 Feb-16-2017, 01:47 PM
Last Post: johnathon

Forum Jump:

User Panel Messages

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