我在tkinter上创造了yahtzee游戏。我认为这将是一个很好的学习开始。我有一个错误说: UnboundLocalError:分配前引用的本地变量'Dice1Butt_clicks' 我已经尝试在代码开头将变量设置为全局变量,我尝试创建一个方法将所有变量设置为全局变量并在我使用变量时调用它但没有任何效果。
不确定我还能做什么? 我可以在没有“+ =”的情况下工作,但我现在比以往任何时候都想要了解正在发生的事情以及为什么Python使一切变得复杂?顺便说一句,我正在使用python 2.7.13。 你能帮帮忙吗?
from tkinter import * #Import everything from Tkinter
from random import randint #import random integer number generator
import tkinter.messagebox #Import messagebox method
########### Create main window, call it root ###########
root = Tk()
###Variables Def
global ran_no, submitv, compv, Die_clicks
##ran_no, submitv, compv, Die_clicks = IntVar(), IntVar(), IntVar(), IntVar()
ran_no = 0 #random value from randint method
submitv = 0 #value that is going to be submited to the TOTAL
compv = 0 #value that is going to be search for in the die (or values in case of sequences, full house, etc
Die_clicks = 0 #value of number of clicks on DiceallButt so that you can only roll the die three times
global Dice1ran_no, Dice2ran_no, Dice3ran_no, Dice4ran_no, Dice5ran_no
##Dice1ran_no, Dice2ran_no, Dice3ran_no, Dice4ran_no, Dice5ran_no = IntVar(), IntVar(), IntVar(), IntVar(), IntVar()
Dice1ran_no, Dice2ran_no, Dice3ran_no, Dice4ran_no, Dice5ran_no = 0, 0, 0, 0, 0
global Dice1Butt_clicks, Dice2Butt_clicks, Dice3Butt_clicks, Dice4Butt_clicks, Dice5Butt_clicks
##Dice1Butt_clicks, Dice2Butt_clicks, Dice3Butt_clicks, Dice4Butt_clicks, Dice5Butt_clicks = IntVar(), IntVar(), IntVar(), IntVar(), IntVar()
Dice1Butt_clicks, Dice2Butt_clicks, Dice3Butt_clicks, Dice4Butt_clicks, Dice5Butt_clicks = 0, 0, 0, 0, 0
global Dice1Butt_clicks
##Dice1Butt_clicks = IntVar()
Dice1Butt_clicks = 0
global TOTAL, threeOAK, fourOAK, fullhouse, smallstr8, largestr8, chance, YAHTZEE
##TOTAL, threeOAK, fourOAK, fullhouse, smallstr8, largestr8, chance, YAHTZEE = IntVar(), IntVar(), IntVar(), IntVar(), IntVar(), IntVar(), IntVar(), IntVar()
TOTAL, threeOAK, fourOAK, fullhouse, smallstr8, largestr8, chance, YAHTZEE = 0, 0 ,0 ,0 ,0 ,0 ,0 ,0
global Lock1, Lock2, Lock3, Lock4, Lock5
##Lock1, Lock2, Lock3, Lock4, Lock5 = BooleanVar(), BooleanVar(), BooleanVar(), BooleanVar(), BooleanVar()
Lock1, Lock2, Lock3, Lock4, Lock5 = FALSE, FALSE, FALSE, FALSE, FALSE
### Methods
def globaliseVars():
global ran_no, submitv, compv, Die_clicks, Dice1ran_no, Dice2ran_no, Dice3ran_no, Dice4ran_no, Dice5ran_no, Dice1Butt_clicks, Dice1Butt_clicks, Dice2Butt_clicks, Dice3Butt_clicks, Dice4Butt_clicks, Dice5Butt_clicks, \
TOTAL, threeOAK, fourOAK, fullhouse, smallstr8, largestr8, chance, YAHTZEE, Lock1, Lock2, Lock3, Lock4, Lock5
def resetdie():
if Die_clicks <= 2:
Dice1Butt.configure(state=NORMAL)
Dice2Butt.configure(state=NORMAL)
Dice3Butt.configure(state=NORMAL)
Dice4Butt.configure(state=NORMAL)
Dice5Butt.configure(state=NORMAL)
Dice1ran_no, Dice2ran_no, Dice3ran_no, Dice4ran_no, Dice5ran_no = 0, 0, 0, 0, 0
Dice1Butt_clicks, Dice2Butt_clicks, Dice3Butt_clicks, Dice4Butt_clicks, Dice5Butt_clicks = 0, 0, 0, 0, 0
ran_no, submitv, compv, Die_clicks = 0, 0, 0, 0
Dice1Butt['text'] = 'Dice 1'
Dice2Butt['text'] = 'Dice 2'
Dice3Butt['text'] = 'Dice 3'
Dice4Butt['text'] = 'Dice 4'
Dice5Butt['text'] = 'Dice 5'
def lock_Dice1Butt():
if Lock1 == TRUE:
Dice1ran_no = ran_no
Dice1Butt.configure(state = DISABLED)
else:
Dice1Butt.configure(state = NORMAL)
def lock_Dice2Butt():
if Lock2 == TRUE:
Dice2ran_no = ran_no
Dice2Butt.configure(state = DISABLED)
else:
Dice2Butt.configure(state = NORMAL)
def lock_Dice3Butt():
if Lock3 == TRUE:
Dice3ran_no = ran_no
Dice3Butt.configure(state = DISABLED)
else:
Dice3Butt.configure(state = NORMAL)
def lock_Dice4Butt():
if Lock4 == TRUE:
Dice4ran_no = ran_no
Dice4Butt.configure(state = DISABLED)
else:
Dice4Butt.configure(state = NORMAL)
def lock_Dice5Butt():
if Lock5 == TRUE:
Dice5ran_no = ran_no
Dice5Butt.configure(state = DISABLED)
else:
Dice5Butt.configure(state = NORMAL)
def updt_TOTAL():
TOTAL = TOTAL + submitv
def updt_Dice1Butt():
Dice1Butt_clicks += 1
if Dice1Butt_clicks > 2:
Dice1Butt.configure(state=DISABLED)
Dice1ran_no = randint(1,6)
Dice1Butt['text'] = str('You drew: ') + str(Dice1ran_no)
def updt_Dice2Butt():
Dice2Butt_clicks += 1
if Dice2Butt_clicks > 2:
Dice2Butt.configure(state=DISABLED)
Dice2ran_no = randint(1,6)
Dice2Butt['text'] = str('You drew: ') + str(Dice2ran_no)
def updt_Dice3Butt():
Dice3Butt_clicks += 1
if Dice3Butt_clicks > 2:
Dice3Butt.configure(state=DISABLED)
Dice3ran_no = randint(1,6)
Dice3Butt['text'] = str('You drew: ') + str(Dice3ran_no)
def updt_Dice4Butt():
Dice4Butt_clicks += 1
if Dice4Butt_clicks > 2:
Dice4Butt.configure(state=DISABLED)
Dice4ran_no = randint(1,6)
Dice4Butt['text'] = str('You drew: ') + str(Dice4ran_no)
def updt_Dice5Butt():
Dice5Butt_clicks += 1
if Dice5Butt_clicks > 2:
Dice5Butt.configure(state=DISABLED)
Dice5ran_no = randint(1,6)
Dice5Butt['text'] = str('You drew: ') + str(Dice5ran_no)
def updt_Die():
Die_clicks += 1
if Die_clicks <= 2:
updt_Dice1Butt
updt_Dice2Butt
updt_Dice3Butt
updt_Dice4Butt
updt_Dice5Butt
else:
Dice1Butt.configure(state=DISABLED)
Dice2Butt.configure(state=DISABLED)
Dice3Butt.configure(state=DISABLED)
Dice4Butt.configure(state=DISABLED)
Dice5Butt.configure(state=DISABLED)
DiceallButt.configure(state=DISABLED)
def updt_ones():
compv = 1
if Dice1ran_no == compv:
submitv =+ Dice1ran_no
if Dice2ran_no == compv:
submitv =+ Dice2ran_no
if Dice3ran_no == compv:
submitv =+ Dice3ran_no
if Dice4ran_no == compv:
submitv =+ Dice4ran_no
if Dice5ran_no == compv:
submitv =+ Dice5ran_no
print submitv
updt_TOTAL()
resetdie()
ones.configure(state=DISABLED)
ONEStext.configure(state=DISABLED)
def updt_twos():
compv = 2
if Dice1ran_no == compv:
submitv += Dice1ran_no
if Dice2ran_no == compv:
submitv += Dice2ran_no
if Dice3ran_no == compv:
submitv += Dice3ran_no
if Dice4ran_no == compv:
submitv += Dice4ran_no
if Dice5ran_no == compv:
submitv += Dice5ran_no
updt_TOTAL()
resetdie()
twos.configure(state=DISABLED)
TWOStext.configure(state=DISABLED)
def updt_threes():
compv = 3
if Dice1ran_no == compv:
submitv += Dice1ran_no
if Dice2ran_no == compv:
submitv += Dice2ran_no
if Dice3ran_no == compv:
submitv += Dice3ran_no
if Dice4ran_no == compv:
submitv += Dice4ran_no
if Dice5ran_no == compv:
submitv += Dice5ran_no
updt_TOTAL()
resetdie()
threes.configure(state=DISABLED)
THREEStext.configure(state=DISABLED)
def updt_fours():
compv = 4
if Dice1ran_no == compv:
submitv += Dice1ran_no
if Dice2ran_no == compv:
submitv += Dice2ran_no
if Dice3ran_no == compv:
submitv += Dice3ran_no
if Dice4ran_no == compv:
submitv += Dice4ran_no
if Dice5ran_no == compv:
submitv += Dice5ran_no
updt_TOTAL()
resetdie()
fours.configure(state=DISABLED)
FOURStext.configure(state=DISABLED)
def updt_fives():
compv = 5
if Dice1ran_no == compv:
submitv += Dice1ran_no
if Dice2ran_no == compv:
submitv += Dice2ran_no
if Dice3ran_no == compv:
submitv += Dice3ran_no
if Dice4ran_no == compv:
submitv += Dice4ran_no
if Dice5ran_no == compv:
submitv += Dice5ran_no
updt_TOTAL()
resetdie()
fives.configure(state=DISABLED)
FIVEStext.configure(state=DISABLED)
def updt_sixes():
compv = 6
if Dice1ran_no == compv:
submitv += Dice1ran_no
if Dice2ran_no == compv:
submitv += Dice2ran_no
if Dice3ran_no == compv:
submitv += Dice3ran_no
if Dice4ran_no == compv:
submitv += Dice4ran_no
if Dice5ran_no == compv:
submitv += Dice5ran_no
updt_TOTAL()
resetdie()
sixes.configure(state=DISABLED)
SIXEStext.configure(state=DISABLED)
def updt_Sum():
submitv += Dice1ran_no + Dice2ran_no + Dice3ran_no + Dice4ran_no + Dice5ran_no
updt_TOTAL()
resetdie()
sum_.configure(state=DISABLED)
SUMtext.configure(state=DISABLED)
def updt_threeOAK():
threeOAK = [Dice1ran_no, Dice2ran_no, Dice3ran_no, Dice4ran_no, Dice5ran_no]
threeOAK.sort()
if threeOAK[0]==threeOAK[1]==threeOAK[2]:
submitv += threeOAK[0] + threeOAK[1] + threeOAK[2]
elif threeOAK[1] == threeOAK[2] == threeOAK[3]:
submitv += threeOAK[1] + threeOAK[2] + threeOAK[3]
elif threeOAK[2]==threeOAK[3]==threeOAK[4]:
submitv += threeOAK[2] + threeOAK[3] + threeOAK[4]
## if Dice1ran_no == Dice2ran_no and Dice2ran_no == Dice3ran_no:
## submitv = submitv =+ Dice1ran_no =+ Dice2ran_no =+ Dice3ran_no
## if Dice2ran_no == Dice3ran_no and Dice3ran_no == Dice4ran_no:
## submitv = submitv =+ Dice2ran_no =+ Dice3ran_no =+ Dice4ran_no
## if Dice3ran_no == Dice4ran_no and Dice4ran_no == Dice5ran_no:
## submitv = submitv =+ Dice3ran_no =+ Dice4ran_no =+ Dice5ran_no
## if Dice1ran_no == Dice2ran_no and Dice1ran_no == Dice4ran_no:
## submitv = submitv =+ Dice1ran_no =+ Dice2ran_no =+ Dice4ran_no
## if Dice1ran_no == Dice2ran_no and Dice2ran_no == Dice5ran_no:
## submitv = submitv =+ Dice1ran_no =+ Dice2ran_no =+ Dice5ran_no
## if Dice2ran_no == Dice3ran_no and Dice3ran_no == Dice5ran_no:
## submitv = submitv =+ Dice2ran_no =+ Dice3ran_no =+ Dice5ran_no
## if Dice3ran_no == Dice4ran_no and Dice4ran_no == Dice5ran_no:
## submitv = submitv =+ Dice3ran_no =+ Dice4ran_no =+ Dice5ran_no
## if Dice1ran_no == Dice3ran_no and Dice3ran_no == Dice4ran_no:
## submitv = submitv =+ Dice1ran_no =+ Dice3ran_no =+ Dice4ran_no
## if Dice1ran_no == Dice3ran_no and Dice3ran_no == Dice5ran_no:
## submitv = submitv =+ Dice1ran_no =+ Dice3ran_no =+ Dice5ran_no
## if Dice1ran_no == Dice4ran_no and Dice4ran_no == Dice5ran_no:
## submitv = submitv =+ Dice1ran_no =+ Dice4ran_no =+ Dice5ran_no
## if Dice2ran_no == Dice4ran_no and Dice4ran_no == Dice5ran_no:
## submitv = submitv =+ Dice2ran_no =+ Dice4ran_no =+ Dice5ran_no
updt_TOTAL()
resetdie()
threeOAK.configure(state=DISABLED)
THREEOAKtext.configure(state=DISABLED)
def updt_fourOAK():
fourOAK = [Dice1ran_no, Dice2ran_no, Dice3ran_no, Dice4ran_no, Dice5ran_no]
fourOAK.sort()
if fourOAK[0] == fourOAK[1] == fourOAK[2] == fourOAK[3]:
submitv += fourOAK[0] + fourOAK[1] + fourOAK[2] + fourOAK[3]
elif fourOAK[1] == fourOAK[2] == fourOAK[3] == fourOAK[4]:
submitv += fourOAK[1] + fourOAK[2] + fourOAK[3] + fourOAK[4]
## if Dice1ran_no == Dice2ran_no and Dice2ran_no == Dice3ran_no and Dice3ran_no == Dice4ran_no:
## submitv = submitv =+ Dice1ran_no =+ Dice2ran_no =+ Dice3ran_no =+ Dice4ran_no
## if Dice1ran_no == Dice3ran_no and Dice3ran_no == Dice4ran_no and Dice4ran_no == Dice5ran_no:
## submitv = submitv =+ Dice1ran_no =+ Dice2ran_no =+ Dice3ran_no =+ Dice4ran_no
## if Dice1ran_no == Dice2ran_no and Dice2ran_no == Dice4ran_no and Dice4ran_no == Dice5ran_no:
## submitv = submitv =+ Dice1ran_no =+ Dice2ran_no =+ Dice4ran_no =+ Dice5ran_no
## if Dice1ran_no == Dice2ran_no and Dice2ran_no == Dice3ran_no and Dice3ran_no == Dice5ran_no:
## submitv = submitv =+ Dice1ran_no =+ Dice2ran_no =+ Dice3ran_no =+ Dice5ran_no
## if Dice2ran_no == Dice3ran_no and Dice3ran_no == Dice4ran_no and Dice4ran_no == Dice5ran_no:
## submitv = submitv =+ Dice2ran_no =+ Dice3ran_no =+ Dice4ran_no =+ Dice5ran_no
updt_TOTAL()
resetdie()
fourOAK.configure(state=DISABLED)
FOUROAKtext.configure(state=DISABLED)
def updt_fullhouse():
fullhouse = [Dice1ran_no, Dice2ran_no, Dice3ran_no, Dice4ran_no, Dice5ran_no]
fullhouse.sort()
if fullhouse[0] == fullhouse [1] and fullhouse[2] == fullhouse [3] == fullhouse[4] or fullhouse[0] == fullhouse [1] == fullhouse[2] and fullhouse [3] == fullhouse[4] :
submitv += fullhouse[0] + fullhouse[1] + fullhouse[2] + fullhouse[3] + fullhouse[4]
updt_TOTAL()
resetdie()
fullhouse.configure(state=DISABLED)
FULLHOUSEtext.configure(state=DISABLED)
def updt_smallstr8():
smallstr8 = [Dice1ran_no, Dice2ran_no, Dice3ran_no, Dice4ran_no, Dice5ran_no]
smallstr8.sort()
if smallstr8[0] == smallstr8 [1] + 1 == smallstr8[2] + 2 == smallstr8 [3] + 3:
submitv += smallstr8[0] + smallstr8[1] + smallstr8[2] + smallstr8[3]
elif smallstr8[1] == smallstr8 [2] + 1 == smallstr8[3] + 2 == smallstr8 [4] + 3:
submitv += smallstr8[1] + smallstr8[2] + smallstr8[3] + smallstr8[4]
updt_TOTAL()
resetdie()
smallstr8.configure(state=DISABLED)
SMALLSTR8text.configure(state=DISABLED)
def updt_largestr8():
largestr8 = [Dice1ran_no, Dice2ran_no, Dice3ran_no, Dice4ran_no, Dice5ran_no]
largestr8.sort()
if largestr8[0] == largestr8 [1] + 1 == largestr8[2] + 2 == largestr8 [3] + 3 == largestr8[4] + 4:
submitv += largestr8[0] + largestr8[1] + largestr8[2] + largestr8[3] + largestr8[4]
updt_TOTAL()
resetdie()
largestr8.configure(state=DISABLED)
LARGESTR8text.configure(state=DISABLED)
def updt_chance():
submitv += Dice1ran_no + Dice2ran_no + Dice3ran_no + Dice4ran_no + Dice5ran_no
updt_TOTAL()
resetdie()
chance.configure(state=DISABLED)
CHANCEtext.configure(state=DISABLED)
def updt_YAHTZEE():
if Dice1ran_no == Dice2ran_no == Dice3ran_no == Dice4ran_no == Dice5ran_no:
submitv += 50
updt_TOTAL()
resetdie()
YAHTZEE.configure(state=DISABLED)
YAHTZEEtext.configure(state=DISABLED)
tkinter.messagebox.showinfo("You've scored a YAHTZEE!! 50 points have been added to your total. Your score is now " + str(TOTAL))
###
Dice1Butt = Button(root, text = 'Dice 1', command = updt_Dice1Butt)
Dice2Butt = Button(root, text = 'Dice 2', command = updt_Dice2Butt)
Dice3Butt = Button(root, text = 'Dice 3', command = updt_Dice3Butt)
Dice4Butt = Button(root, text = 'Dice 4', command = updt_Dice4Butt)
Dice5Butt = Button(root, text = 'Dice 5', command = updt_Dice5Butt)
Radio1Butt = Radiobutton(root, text = 'Lock Dice 1', variable = 'Lock1', value = FALSE, command = lock_Dice1Butt)
Radio2Butt = Radiobutton(root, text = 'Lock Dice 2', variable = 'Lock2', value = FALSE, command = lock_Dice2Butt)
Radio3Butt = Radiobutton(root, text = 'Lock Dice 3', variable = 'Lock3', value = FALSE, command = lock_Dice3Butt)
Radio4Butt = Radiobutton(root, text = 'Lock Dice 4', variable = 'Lock4', value = FALSE, command = lock_Dice4Butt)
Radio5Butt = Radiobutton(root, text = 'Lock Dice 5', variable = 'Lock5', value = FALSE, command = lock_Dice5Butt)
DiceallButt = Button(root, text = 'Roll All Die', command = updt_Die)
onesButt = Button(root, text = 'Ones', command = updt_ones)
twosButt = Button(root, text = 'Twos', command = updt_twos)
threesButt = Button(root, text = 'Threes', command = updt_threes)
foursButt = Button(root, text = 'Fours', command = updt_fours)
fivesButt = Button(root, text = 'Fives', command = updt_fives)
sixesButt = Button(root, text = 'Sixes', command = updt_sixes)
sumButt = Button(root, text = 'Sum', command = updt_Sum)
threeOAKButt = Button(root, text = 'ThreeOAK', command = updt_threeOAK)
fourOAKButt = Button(root, text = 'FourOAK', command = updt_fourOAK)
fullhouseButt = Button(root, text = 'FullHouse', command = updt_fullhouse)
smallstr8Butt = Button(root, text = 'Small Straight', command = updt_smallstr8)
largestr8Butt = Button(root, text = 'Large Straight', command = updt_largestr8)
chanceButt = Button(root, text = 'Chance', command = updt_chance)
YAHTZEEButt = Button(root, text = 'YAHTZEE', command = updt_YAHTZEE)
ONEStext = Text(width=4, height=2, wrap =WORD)
TWOStext = Text(width=4, height=2, wrap =WORD)
THREEStext = Text(width=4, height=2, wrap =WORD)
FOURStext = Text(width=4, height=2, wrap =WORD)
FIVEStext = Text(width=4, height=2, wrap =WORD)
SIXEStext = Text(width=4, height=2, wrap =WORD)
SUMtext = Text(width=4, height=2, wrap =WORD)
THREEOAKtext = Text(width=4, height=2, wrap =WORD)
FOUROAKtext = Text(width=4, height=2, wrap =WORD)
FULLHOUSEtext = Text(width=4, height=2, wrap =WORD)
SMALLSTR8text = Text(width=4, height=2, wrap =WORD)
LARGESTR8text = Text(width=4, height=2, wrap =WORD)
CHANCEtext = Text(width=4, height=2, wrap =WORD)
YAHTZEEtext = Text(width=4, height=2, wrap =WORD)
TOTALtext = Text(width=15, height=5, wrap =WORD)
Dice1Butt.grid(row=0, column=0, pady=10)
Dice2Butt.grid(row=1, column=0, pady=10)
Dice3Butt.grid(row=2, column=0, pady=10)
Dice4Butt.grid(row=3, column=0, pady=10)
Dice5Butt.grid(row=4, column=0, pady=10)
Radio1Butt.grid(row=0, column=1, pady=10)
Radio2Butt.grid(row=1, column=1, pady=10)
Radio3Butt.grid(row=2, column=1, pady=10)
Radio4Butt.grid(row=3, column=1, pady=10)
Radio5Butt.grid(row=4, column=1, pady=10)
DiceallButt.grid(row=5, column=0, columnspan=1, padx=10, pady=10)
onesButt.grid(row=0, column=3, pady=10)
ONEStext.grid(row=0, column=4, pady=10)
twosButt.grid(row=1, column=3, pady=10)
TWOStext.grid(row=1, column=4, pady=10)
threesButt.grid(row=2, column=3, pady=10)
THREEStext.grid(row=2, column=4, pady=10)
foursButt.grid(row=3, column=3, pady=10)
FOURStext.grid(row=3, column=4, pady=10)
fivesButt.grid(row=4, column=3, pady=10)
FIVEStext.grid(row=4, column=4, pady=10)
sixesButt.grid(row=5, column=3, pady=10)
SIXEStext.grid(row=5, column=4, pady=10)
sumButt.grid(row=6, column=3, pady=10)
SUMtext.grid(row=6, column=4, pady=10)
threeOAKButt.grid(row=7, column=3, pady=10)
THREEOAKtext.grid(row=7, column=4, pady=10)
fourOAKButt.grid(row=8, column=3, pady=10)
FOUROAKtext.grid(row=8, column=4, pady=10)
fullhouseButt.grid(row=9, column=3, pady=10)
FULLHOUSEtext.grid(row=9, column=4, pady=10)
smallstr8Butt.grid(row=10, column=3, pady=10)
SMALLSTR8text.grid(row=10, column=4, pady=10)
largestr8Butt.grid(row=11, column=3, pady=10)
LARGESTR8text.grid(row=11, column=4, pady=10)
chanceButt.grid(row=12, column=3, pady=10)
CHANCEtext.grid(row=12, column=4, pady=10)
YAHTZEEButt.grid(row=13, column=3, pady=10)
YAHTZEEtext.grid(row=13, column=4, pady=10)
TOTALtext.grid(row=6, column=0, rowspan=6,sticky=W, padx=10)
###
root.title("YAHTZEE against Yuri")
root.geometry("500x800")
root.mainloop()
答案 0 :(得分:0)
在python中,您可以按名称访问全局变量,但是如果要更改它们(使用+ =, - =,=,...),则需要在中使用 global 关键字em>那个功能。
所以在你的情况下它应该是:
def updt_Dice1Butt():
global Dice1Butt_clicks # note this line
Dice1Butt_clicks += 1
if Dice1Butt_clicks > 2:
Dice1Butt.configure(state=DISABLED)
Dice1ran_no = randint(1,6)
Dice1Butt['text'] = str('You drew: ') + str(Dice1ran_no)
依旧......