-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtabbedFrameExample.py
More file actions
29 lines (22 loc) · 894 Bytes
/
Copy pathtabbedFrameExample.py
File metadata and controls
29 lines (22 loc) · 894 Bytes
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
from direct.showbase.ShowBase import ShowBase
from direct.gui.DirectFrame import DirectFrame
from DirectGuiExtension.DirectTabbedFrame import DirectTabbedFrame
ShowBase()
width = base.get_size()[0]
height = base.get_size()[1]
dtf = DirectTabbedFrame(
base.pixel2d,
frameSize = (0, width, -height, 0),
tabHeight=24)
def onCloseFunc(tab):
print(f"closed {tab}")
fillSize = (0, width, -height, -dtf["tabHeight"])
tab1frame = DirectFrame(dtf, frameSize=fillSize, frameColor=(1,0,0,1))
tab2frame = DirectFrame(dtf, frameSize=fillSize, frameColor=(0,1,0,1))
tab3frame = DirectFrame(dtf, frameSize=fillSize, frameColor=(0,0,1,1))
tab4frame = DirectFrame(dtf, frameSize=fillSize, frameColor=(1,0,1,1))
dtf.add_tab("Tab 1", tab1frame, onCloseFunc)
dtf.add_tab("Tab 2", tab2frame, None)
dtf.add_tab("Tab 3", tab3frame, None)
dtf.add_tab("Tab 4", tab4frame, onCloseFunc)
base.run()