python中类中randint函数的类型错误
实际上,我在tkinter模块的randint函数类中遇到了一个类型错误,请您帮助我解决这个错误,我将非常感谢您。谢谢您python中类中randint函数的类型错误,python,Python,实际上,我在tkinter模块的randint函数类中遇到了一个类型错误,请您帮助我解决这个错误,我将非常感谢您。谢谢您randint()需要一个范围:a(起始编号)-b(结束编号)。您提供了一个单一元素的列表 您可以在程序中看到: def rpc(self): self.kl=Label(self.stone,font=('arial',60,'bold'),text='Stone Paper and Scissor game',bd=21,bg='black
randint()
需要一个范围:a(起始编号)-b(结束编号)。您提供了一个单一元素的列表
您可以在程序中看到:
def rpc(self):
self.kl=Label(self.stone,font=('arial',60,'bold'),text='Stone Paper and Scissor game',bd=21,bg='black',fg='cornsilk',justify=CENTER)
self.kl.grid(row=0)
self.sp1 = StringVar()
self.sp1.set("paper")
self.tn1 = Button(self.tone,bg='orange',text="Paper",height=2,width=15,textvariable=self.sp1)
self.tn1.grid(row=3,column=0)
self.sp2 = StringVar()
self.sp2.set("stone")
self.tn2 = Button(self.tone,bg='orange',text="stone",height=2,width=15,textvariable=self.sp2)
self.tn2.grid(row=4,column=0)
self.sp3 = StringVar()
self.sp3.set("scissors")
self.tn3 = Button(self.tone,bg='orange',text="scissor",height=2,width=15,textvariable=self.sp3)
self.tn3.grid(row=4,column=0)
a = (self.sp1.get())
b = (self.sp2.get())
c = (self.sp3.get())
self.user = (self.sp1.get()),(self.sp2.get()),(self.sp3.get)
self.comp = ((self.sp1.get()),(self.sp2.get()),(self.sp3.get()))
randint([self,self.comp])
File "c:\Users\mudit\Desktop\file docs\Mudit Docs\phython\program of clases.py", linein
rpc883,
randint([self,self.comp])
TypeError: randint() missing 1 required positional argument: 'b'
请包含错误的完整回溯,因为其中包含诊断问题的重要信息,可能更好地使用
import random
print(random.randint(2,10))