Guest User

Untitled

a guest
Aug 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.83 KB | None | 0 0
  1. ["/home/shubham/Desktop/movies/djangounchained.mkv"]
  2.  
  3. "yoo"
  4.  
  5. []
  6.  
  7. "yoo"
  8.  
  9. from gui import app
  10. from list_directory import display_files
  11. import tkinter as tk
  12.  
  13. root = tk.Tk()
  14. directory = input("Enter directory name:")
  15. root.geometry("400x300")
  16. widgets_creator = app(root)
  17. name = "get list"
  18. directory_button = widgets_creator.create_button(name,function=display_files,path=directory)
  19. root.mainloop()
  20.  
  21. import tkinter as tk
  22.  
  23. class app(tk.Frame):
  24. def __init__(self,master):
  25. super(app,self).__init__(master=master)
  26. self.master = master
  27. self.init_window()
  28.  
  29. def init_window(self):
  30.  
  31. # changing the title of our master widget
  32. self.master.title("GUI")
  33.  
  34. # allowing the widget to take the full space of the root window
  35. self.pack(fill=tk.BOTH, expand=1)
  36.  
  37. # creating a button instance
  38. quitButton = tk.Button(self, text="Quit")
  39.  
  40. # placing the button on my window
  41. quitButton.place(x=0, y=0)
  42.  
  43.  
  44. def create_button(self,button_name,function,path):
  45. button = tk.Button(self.master,text=button_name,command=lambda: function(path))
  46. button.place(x=200,y=5)
  47. return button
  48.  
  49. import glob
  50. def display_files(path):
  51. x = glob.glob(path)
  52. print(x)
  53. print("yoo")
  54.  
  55. if __name__ == '__main__':
  56. display_files("/home/shubham/Desktop/movies/*")
Add Comment
Please, Sign In to add comment