Just as a practice I typed in the demo code from the manual for DirectWaitBar.
First the code in the manual will not complile without
from padac.pandaModules import TextNode.
That is not in the maual example.
After I entered that line the example complied fine but then I decided to add some other things just to practice. I added "range = 100, barRelief= SUNKEN) to the DirectWaitBar statement I got a python error that said
“NameError: name ‘SUNKEN’ is not defined”
Thinking I may need to add a bit of a frame to make that work I added
Still the same error.
The manual says these are all valid keywords to add to a DircectWaitBar statement why is it not working?
Here is my code:
import direct.directbase.DirectStart from pandac.PandaModules import TextNode from direct.gui.OnscreenText import OnscreenText from direct.gui.DirectGui import * #add some text bk_text = "This is my Demo" textObject = OnscreenText(text = bk_text,pos = (0.95,0.95), scale = 0.07,fg = (1,0.5,0.5,1),align = TextNode.ACenter,mayChange=1) #Callback fucntions to set text def incBar(arg): bar['value'] += arg text = "Progress is:" + str(bar['value']) + "%" textObject.setText(text) #create a frame frame =DirectFrame(text = "main", scale = 0.001) #add button bar = DirectWaitBar(text = "",value=50, range = 100,barRelief = SUNKEN,barBorderWidth= (5,5),pos=[0,.4,.4]) # create 4 buttons button_1 = DirectButton(text = "+1",scale = 0.05,pos =(-.3,.6,0),command = incBar,extraArgs = ) button_10 = DirectButton(text = "+10",scale = 0.05,pos =(0,.6,0),command = incBar,extraArgs = ) button_m1 = DirectButton(text = "-1",scale = 0.05,pos =(.3,.6,0),command = incBar,extraArgs = [-1]) button_m10 = DirectButton(text = "-10",scale = 0.05,pos =(.6,.6,0),command = incBar,extraArgs = [-10]) # run the tutorial run()