Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. self.varLoc= StringVar(master)
  2. self.varLoc.set("status")
  3.  
  4. self.varColumn= StringVar(master)
  5. self.varColumn.set("")
  6.  
  7. self.locationColumn= Label(master,text="Select a column as a location indicator", font=("Helvetica", 12))
  8. self.columnLabel= Label(master,text="Select a column to process", font=("Helvetica", 12))
  9.  
  10. global locationOption
  11. global columnOption
  12. columnOption= OptionMenu (master, self.varColumn,"",*columnList)
  13. locationOption= OptionMenu (master, self.varLoc,"",*columnList)
  14.  
  15. self.locationColumn.grid (row=5, column=1, pady=(20,0), sticky=W, padx=(5,0))
  16. locationOption.grid (row=5, column=3, pady=(20,0))
  17.  
  18. def browser (selft):
  19. filename = askopenfilename()
  20. #open_file(filename)
  21. t=threading.Thread (target=open_file, args=(filename, ))
  22. #t=thread.start_new_thread (open_file,(filename, )) # create a new thread to handle the process of opening the file.
  23. # we must then send the file name to the function that reads it somehow.
  24. t.start()
  25. 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.
  26. opt=columnOption.children ['menu']
  27. optLoc= locationOption.children ['menu']
  28. optLoc.entryconfig (0,label= columnList [0], command=selft.justamethod)
  29. opt.entryconfig (0, label= columnList [0], command=selft.justamethod)
  30. for i in range(1,len (columnList)):
  31. opt.add_command (label=columnList[i], command=selft.justamethod)
  32. optLoc.add_command (label=columnList[i], command=selft.justamethod)
  33.  
  34. def justamethod (self):
  35. print("method is called")
  36. print(self.varLoc.get())
  37.  
  38. window= Tk () #main window.
  39. starter= Interface (window)
  40.  
  41.  
  42. window.mainloop() #keep the window open until the user decides to close it.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement