这是我的代码,在main方法中,只有一个行:的Panda3D startingwindow作品或者作品不是没有道理的
game.initShowBase()
这个函数的代码则是:
def initShowBase():
global myShowBase
myShowBase = ShowBase(False)
startwindowThread = threading.Thread(target = starters.startfunction)
startwindowThread.start()
myShowBase.run()
首发然后:
def startfunction():
from modules.logic import game
global h
h = 0
print h
# g1 = open ("game1", "a")
#g1.close()
#g2 = open ("game2", "a")
#g2.close()
#g3 = open ("game3", "a")
#g3.close()
game.myShowBase.setBackgroundColor(1.0,0.627,0.894, 1)
textObject = OnscreenText(text = "Beginn", pos = (0.95,-0.95),
scale = 0.07,fg=(1,0.5,0.5,1),align=TextNode.ACenter,mayChange=1)
buttons = [
DirectRadioButton(text = 'Game 1 ', scale=0.05, indicatorValue = 0, pos=(-0.4,0,0), command=load, extraArgs =[1]),
DirectRadioButton(text = 'Game 2 ', scale=0.05, indicatorValue = 0, pos=(0,0,0), command=load, extraArgs = [2]),
DirectRadioButton(text = 'Game 3 ', scale=0.05, indicatorValue = 0, pos=(0.4,0,0), command=load, extraArgs = [3])
]
print "button"
for button in buttons:
button.setOthers(buttons)
print "true"
def load(gamenumber):
global h
if (gamenumber==1):
h += 1
if (h>0):
loadGame("game1")
elif (gamenumber==2):
loadGame("game2")
else:
loadGame("game3")
def loadGame (gamename):
from modules.logic import game
global data
data = open (gamename, "r")
print gamename
没有对代码进行任何更改,我有时会得到没有任何按钮,黑色的窗口,一个粉红色的窗口(右结肠r)没有任何按钮或带有全部三个按钮的粉红色窗口。
没有堆栈跟踪,因为编译器从来没有看到错误,所以我想我有一个死锁的地方。 我只是没有找到它,我的意思是,它不是这么多的代码。
任何人都可以帮忙吗?
也许我还应该提到indicatorValue似乎不起作用 - 第一个按钮,如果它出现,总是设置。
没有堆栈跟踪我不知道在哪里查找 – newnewbie 2013-03-14 22:30:00
我刚试过5次 - ,第五个在粉色屏幕上没有按钮,没有人有想法在哪里寻找错误吗?请... – newnewbie 2013-03-14 22:50:46