你好,我正在做一个彩色屏幕的工作,我可以用我的代码改变单词和单词的颜色,但是我不能只在调用我的函数“next\u selected”时改变单词,有人能帮我吗?你知道吗
def tick():
global doTick
global sec
if not doTick:
return
sec += 0.1
sec = round(sec, 1)
ftest1.after(100, tick)
time2Label.configure(text=sec)
if sec == 60.0:
doTick = False
time2Label.config(text=sec)
label1.config(text=score, fg='black')
def start():
global doTick
doTick = True
label1.pack()
tick()
startbutton1.destroy()
COLORS = ['blue','green','yellow','red']
def stimulus(same):
global word
colors = list(COLORS)
if same:
return (word)
colors.remove(word)
return (word)
def next_selected():
global word
word = stimulus(choice((True,False)))
label1.config(text=word)
label1.update()
stimulus()
无法在same=False
时选择新颜色,也无法在全局word
中保存该新选择。试一试:相关问题 更多 >
编程相关推荐