|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
tkinter 怎么传参数进来呀?
正则里有个变量需要用tkinter传参数进来,
也就是用户可以定制这个规则的一部分,
可以我弄了总报错,不太会弄这个
urlname = e.get()
AttributeError: 'NoneType' object has no attribute 'get'
设置的函数是这样的
- def insert_point():
- urlname = e.get()
- if len(urlname) < 1:
- urlname = 'netafim.c'
- else:
- print(urlname)
- pattern = re.compile(r'(?<=({})).*?(?=</a>)'.format(urlname))
复制代码
就是,如果没有用户输入的的情况呀,使用程序默认的参数
如果有用户输入,就用用户输入的参数
报错
urlname = e.get()
AttributeError: 'NoneType' object has no attribute 'get'
- e = Entry(root, show=None, width=30, bd=4).pack()
- b1 = Button(root, text='上面输入域名确定', width=15, height=1, command=insert_point)
- b1.pack()
复制代码 \
有人能帮我一下吗
e = Entry(root, show=None, width=30, bd=4).pack()
拆成两句
e = Entry(root, show=None, width=30, bd=4)
e.pack()
|
|