使用函数在python中显示图像并绘制它们

时间:2013-11-09 20:02:33

标签: python zelle-graphics

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)我需要打印的图像?任何帮助都是慷慨的赞赏。

0 个答案:

没有答案