如何使用tkinter pack()方法将小部件放在下一行?我用过pack(side = LEFT)但我不能像我上传的图片那样。pack(side = LEFT)仅剩...我不能放下一行小部件。我想知道..
[
]
from tkinter import *
app = Tk()
app.title('')
app.geometry("800x1200")
Label(app, text = 'a:').pack(side= LEFT)
a = Entry(app)
a.insert(0, "")
a.pack(side= LEFT)
Label(app, text = 'b:').pack(side= LEFT)
b = Entry(app)
b.insert(0, "")
b.pack(side= LEFT)
Label(app, text = 'c:').pack(side= LEFT)
c = Entry(app)
c.insert(0, "")
c.pack(side= LEFT)
Label(app, text = 'd:').pack(side= LEFT)
d = Entry(app)
d.insert(0, "")
d.pack(side= LEFT)
Label(app, text = 'e:').pack(side= LEFT)
e = Entry(app)
e.insert(0, "")
e.pack(side= LEFT)
Label(app, text = 'f:').pack(side= LEFT)
f = Entry(app)
f.insert(0, "")
f.pack(side= LEFT)
Label(app, text = 'g:').pack(side= LEFT)
g = Entry(app)
g.insert(0, "")
g.pack(side= LEFT)
Label(app, text = 'h:').pack(side= LEFT)
h = Entry(app)
h.insert(0, "")
h.pack(side= LEFT)
Label(app, text = '').pack()
text = Text(app, width=100,height=12)
text.insert('1.0', "text")
text.pack()
Label(app, text = '').pack()
text2 = Text(app, width=100,height=12)
text2.insert('1.0', "text")
text2.pack()
Button(app, text = 'save ').pack()
app.mainloop()
Run Code Online (Sandbox Code Playgroud)
追溯(最近一次通话最近):文件“ D:/34545.py”,第2行,位于Label(app,text ='a:')。pack(side = LEFT)中NameError:未定义名称“ Label”
| 归档时间: |
|
| 查看次数: |
4765 次 |
| 最近记录: |