Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- self.varLoc= StringVar(master)
- self.varLoc.set("status")
- self.varColumn= StringVar(master)
- self.varColumn.set("")
- self.locationColumn= Label(master,text="Select a column as a location indicator", font=("Helvetica", 12))
- self.columnLabel= Label(master,text="Select a column to process", font=("Helvetica", 12))
- global locationOption
- global columnOption
- columnOption= OptionMenu (master, self.varColumn,"",*columnList)
- locationOption= OptionMenu (master, self.varLoc,"",*columnList)
- self.locationColumn.grid (row=5, column=1, pady=(20,0), sticky=W, padx=(5,0))
- locationOption.grid (row=5, column=3, pady=(20,0))
- def browser (selft):
- filename = askopenfilename()
- #open_file(filename)
- t=threading.Thread (target=open_file, args=(filename, ))
- #t=thread.start_new_thread (open_file,(filename, )) # create a new thread to handle the process of opening the file.
- # we must then send the file name to the function that reads it somehow.
- t.start()
- t.join() #I use join because if I didn't,next lines will execute before open_file is completed, this will make columnList empty and the code will not execute.
- opt=columnOption.children ['menu']
- optLoc= locationOption.children ['menu']
- optLoc.entryconfig (0,label= columnList [0], command=selft.justamethod)
- opt.entryconfig (0, label= columnList [0], command=selft.justamethod)
- for i in range(1,len (columnList)):
- opt.add_command (label=columnList[i], command=selft.justamethod)
- optLoc.add_command (label=columnList[i], command=selft.justamethod)
- def justamethod (self):
- print("method is called")
- print(self.varLoc.get())
- window= Tk () #main window.
- starter= Interface (window)
- window.mainloop() #keep the window open until the user decides to close it.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement