Ray_199298
2017-12-05 05:57Python方法的问题,请问如何单独定义某个属性
label1 = Label(frame2,text='密码:')
v2 = StringVar()
label1.pack(side=LEFT)
e2 = Entry(frame2,textvariable=v2,show='*') 【1】
e2.show = '*' 【2】
e2(show('*')) 【3】
e2.pack(side=RIGHT)
frame2.pack(padx=10,pady=10)
#我想把 【1】中的show方法 我想通过 【2】【3】这种方式单独定义
但是结果是 【2】这样写 show方法没有实现 无效
【3】这样写 系统提示未定义 NameError: name 'show' is not defined
我想问 如果我想单独定义的话 正确的应该怎么写呢
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- python中为何要用初始化对象的方式来添加属性?
- python
- 2个回答
- 关于python自动化运维的一些问题
- django
- flask
- python
- 云计算
- 2个回答
- Python 通过方法修改属性的值 无反应
- python
- 1个回答
- vs2017中python 为函数定义函数文档出错
- python
- 1个回答
- python中定义了两个函数,但报错其中一个未定义?
- python
- 3个回答
换一换