-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo.py
37 lines (32 loc) · 1017 Bytes
/
demo.py
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
from direct.showbase.ShowBase import ShowBase
from panda3d.core import loadPrcFileData
from DirectFolderBrowser.DirectFolderBrowser import DirectFolderBrowser
from DirectFolderBrowser.DarkTheme import Theme as DarkTheme
loadPrcFileData("", "notify-level info")
app = ShowBase()
def callbackCommand(ok):
if ok == 1:
print("User Clicked OK")
# print the selected file
print(browser.get())
browser.hide()
browser.destroy()
exit(ok)
if ok == 0:
print("User Clicked Cancel")
browser.hide()
browser.destroy()
exit(ok)
# show the browser as file browser
browser = DirectFolderBrowser(
callbackCommand,
fileBrowser=True,
# to enable dark mode, uncomment the folowing line
#theme=DarkTheme(),
askForOverwrite=True,
usePathBar=False,
title="File Selection",
#fileExtensions=[".txt"],
fileFilters={"All":[], "Text": [".txt"], "Code":[".py", ".sh"], "models":[".egg", ".bam", ".pz"]}
)
app.run()