Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i put widget next row using tkinter pack() method?

Tags:

python

tkinter

how can i put widget next row using tkinter pack() method?? i used pack(side= LEFT) but i can't make like my upload picture . pack(side= LEFT) is only left... i can't put next row widget. i wonder..

[I can't like this image using tkinter.. click to show image]

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()

Traceback (most recent call last): File "D:/34545.py", line 2, in Label(app, text = 'a:').pack(side= LEFT) NameError: name 'Label' is not defined

like image 650
오은아은아 Avatar asked Jul 27 '26 01:07

오은아은아


1 Answers

If you want to use pack, then you need to put buttons A, B, C, and D in one frame, and buttons E, F, G, and H in another frame. Another option would be to put all of those buttons in a single frame using grid.

like image 122
Bryan Oakley Avatar answered Jul 29 '26 16:07

Bryan Oakley