I have created this GUI:
import tkinter as tk
import tkinter.font as tkFont
from tkinter.filedialog import askopenfilename
class App:
def __init__(self, root):
#setting title
root.title("undefined")
#setting window size
width=600
height=500
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
root.geometry(alignstr)
root.resizable(width=False, height=False)
GButton_100=tk.Button(root) #Button to Run a specific script
GButton_100["bg"] = "#efefef"
ft = tkFont.Font(family='Times',size=10)
GButton_100["font"] = ft
GButton_100["fg"] = "#000000"
GButton_100["justify"] = "center"
GButton_100["text"] = "Run Analysis"
GButton_100.place(x=330,y=420,width=254,height=62)
GButton_100["command"] = self.GButton_100_command
GButton_164=tk.Button(root,command=self.changeText) #data loader
GButton_164["bg"] = "#efefef"
ft = tkFont.Font(family='Times',size=10)
GButton_164["font"] = ft
GButton_164["fg"] = "#000000"
GButton_164["justify"] = "center"
GButton_164["text"] = "Load Data"
GButton_164.place(x=240,y=20,width=131,height=33)
GButton_164["command"] = self.GButton_164_command
GListBox_595=tk.Listbox(root) #list to show the excel file to be loaded
GListBox_595["borderwidth"] = "1px"
ft = tkFont.Font(family='Times',size=10)
GListBox_595["font"] = ft
GListBox_595["fg"] = "#333333"
GListBox_595["justify"] = "center"
GListBox_595.place(x=0,y=130,width=597,height=157)
GMessage_611=tk.Message(root) #message to be changed
ft = tkFont.Font(family='Times',size=10)
GMessage_611["font"] = ft
GMessage_611["fg"] = "#333333"
GMessage_611["justify"] = "center"
GMessage_611["text"] = self.changeText
GMessage_611.place(x=10,y=20,width=217,height=30)
def GButton_100_command(self):
print("command")
def GButton_164_command(self):
filename = askopenfilename() # show an "Open" dialog box and return the path to the selected file
print(filename)
def changeText(self):
self.changeText(filename)
if __name__ == "__main__":
root = tk.Tk()
app = App(root)
root.mainloop()
and I want once it loads the file, the message to change to filename , and the list to show the excel file data. Also, the run button is supposed to run a script but this will be done in a secondary phase. Unfortunately I'm quite newbie in GUI design but I've tried to design it and create some kind of interraction among widgets of this. Any help.? Thanks world