diff options
| -rw-r--r-- | README.md | 43 | ||||
| -rw-r--r-- | demoimage.png | bin | 0 -> 24162 bytes | |||
| -rw-r--r-- | tkFileBrowser.py | 2 |
3 files changed, 44 insertions, 1 deletions
@@ -1,2 +1,45 @@ # tkFileBrowser A file browser designed for use with Python tkinter applications + +) + +* Uses the Windows API to get the exact icon for any folder or application. +* Refreshes when drives are added or removed +* Final version will refresh the tree too + +## Example Usage + + def on_click(path): + print("click: ", path) + + if __name__ == "__main__": + root = tk.Tk() + browser = TkFileBrowser(root, on_click) + browser.pack(side = tk.LEFT) + + ttk.Button(root, text = "Goto", command = lambda: browser.see(r"C:\Any\file\or\folder")).pack(side = tk.LEFT) + + root.mainloop() + +## Documentation +TkFileBrowser(parent, command, [refresh = 20], [types = []], [showhidden = False]) + +> parent + +Frame in which the widget will be placed + +>command + +Function to be run when the user clicks on a file. The path is an argument + +>refresh + +How often to check for updates in the file system. Default 20ms + +>types + +List of file types that will show up. Empty means all files. Default [] + +>showhidden + +Show hidden files "." or not. Default False diff --git a/demoimage.png b/demoimage.png Binary files differnew file mode 100644 index 0000000..78bd13e --- /dev/null +++ b/demoimage.png diff --git a/tkFileBrowser.py b/tkFileBrowser.py index a98c2fe..8b88606 100644 --- a/tkFileBrowser.py +++ b/tkFileBrowser.py @@ -335,6 +335,6 @@ if __name__ == "__main__": browser = TkFileBrowser(root, on_click) browser.pack(side = tk.LEFT) - ttk.Button(root, text = "Goto", command = lambda: browser.see(r"C:\Users\Edward\Documents\random_pyapps")).pack(side = tk.LEFT) + ttk.Button(root, text = "Goto", command = lambda: browser.see(r"C:\Any\file\or\folder")).pack(side = tk.LEFT) root.mainloop()
\ No newline at end of file |
