我第一次和特金特鬼混,有个问题。有没有办法对tkinter输入字段进行编码?这是我的密码:
my_username = Entry(window,width=10)
my_username.grid(column=1, row=0)
#a few lines that have nothing to do with username
username = my_username.encode('utf-8')
问题是:
Traceback (most recent call last):
File "project.py", line 34, in <module>
username = my_username.encode('utf-8')
AttributeError: 'Entry' object has no attribute 'encode'
有没有合适的方法对输入字段进行编码? 谢谢
不,您不能对小部件本身进行编码,因为编码是一个字符串操作,而小部件不是字符串。但是,您可以对从小部件获得的数据进行编码
相关问题 更多 >
编程相关推荐