|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
《0基础学PYTHON》P17_18.py
from tkinter import *
root = Tk()
#theLB = Listbox(root,setgrid=True)
theLB = Listbox(master,height =11) #每次运行的时候 这行代码总是出问题。
theLB.pack()
for item in range(11):
theLB.insert(END,item)
mainloop()
返回错误如下:
Traceback (most recent call last):
File "D:/软件程序/编程练习/p17_18.py", line 8, in <module>
theLB = Listbox(master,height =11)
NameError: name 'master' is not defined. Did you mean: 'aiter'?
请问这个情况怎么处理呢? 前面还有个例子也是有master这个参数的问题 一直没有解决。
- from tkinter import *
- root = Tk()
- #theLB = Listbox(root,setgrid=True)
- theLB = Listbox(root,height =11) # 把 master 换成 root
- theLB.pack()
- for item in range(11):
- theLB.insert(END,item)
- mainloop()
复制代码
|
|