我正在编写一个简单的程序,它基本上可以发出随机单词。但是这发生了。
AttributeError: 'int' object has no attribute 'encode'
Run Code Online (Sandbox Code Playgroud)
这是程序。
from tkinter import *
import random,os,sys,shelve,pickle
def atoi(s):
rtr=0
for c in s:
rtr=rtr*10 + ord(c) - ord('0')
return rtr
class Application(Frame):
"a application baced GUI"
def __init__(self,master):
"to initilize the frame"
super(Application,self).__init__(master)
self.grid()
self.create_widgets()
def create_widgets(self):
self.bttn_to_sumbit = Button(self,text = "SHOOT!",command = self.shoot)
self.bttn_to_sumbit.grid(row = 4,column = 5,sticky = E)
self.ins = Text(self, width = 30, height = 20, wrap = WORD)
self.ins.grid(row = 11, column = 1, sticky = …
Run Code Online (Sandbox Code Playgroud) python ×1