aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 961fbc39d94cb30ffe6d736e5338b08fbf82c974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# tkFileBrowser
A file browser designed for use with Python tkinter applications

![Demo image](https://github.com/jwansek/tkFileBrowser/blob/master/demoimage.png?raw=true)

* Uses the Windows API to get the exact icon for any folder or application.
* Refreshes when drives are added or removed

## 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

>.see(path)

Open all nodes to a path and ensure it is shown on screen

More coming!