Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ["/home/shubham/Desktop/movies/djangounchained.mkv"]
- "yoo"
- []
- "yoo"
- from gui import app
- from list_directory import display_files
- import tkinter as tk
- root = tk.Tk()
- directory = input("Enter directory name:")
- root.geometry("400x300")
- widgets_creator = app(root)
- name = "get list"
- directory_button = widgets_creator.create_button(name,function=display_files,path=directory)
- root.mainloop()
- import tkinter as tk
- class app(tk.Frame):
- def __init__(self,master):
- super(app,self).__init__(master=master)
- self.master = master
- self.init_window()
- def init_window(self):
- # changing the title of our master widget
- self.master.title("GUI")
- # allowing the widget to take the full space of the root window
- self.pack(fill=tk.BOTH, expand=1)
- # creating a button instance
- quitButton = tk.Button(self, text="Quit")
- # placing the button on my window
- quitButton.place(x=0, y=0)
- def create_button(self,button_name,function,path):
- button = tk.Button(self.master,text=button_name,command=lambda: function(path))
- button.place(x=200,y=5)
- return button
- import glob
- def display_files(path):
- x = glob.glob(path)
- print(x)
- print("yoo")
- if __name__ == '__main__':
- display_files("/home/shubham/Desktop/movies/*")
Add Comment
Please, Sign In to add comment