def dice1():
dice1 = Image(Point(50, 100),'one.gif')
return dice1
def dice2():
dice2 = Image(Point(50,100),'two.gif')
return dice2
def dice3():
dice3 = Image(Point(50,100),'three.gif')
return dice3
def dice4():
dice4 = Image(Point(50,100),'four.gif')
return dice4
def dice5():
dice5 = Image(Point(50,100),'five.gif')
return dice5
def dice6():
dice6 = Image(Point(50,100),'six.gif')
return dice6
def displaying_dice(arg1):
if arg1 == 1:
printed = dice1()
elif arg1 == 2:
printed = dice2()
elif arg1 == 3:
printed = dice3()
elif arg1 == 4:
printed = dice4()
elif arg1 == 5:
printed = dice5()
elif arg1 == 6:
printed = dice6()
return printed
这个问题也与我在 python 中涉及 Zelle Graphics 的其他问题有关。我在这里遇到的问题是我上面的内容也可以满足我的需要。我使用我的 display_dice() 函数来确定掷出的数字,然后根据该掷出的结果返回需要绘制的骰子。但是,说明告诉我,我的 display_dice() 函数不应该返回任何类型的值,这就是我感到困惑的地方,因为如果我不能从中返回值,我应该如何 .draw(graph_win)我需要打印的图像?任何帮助将不胜感激。