tkinter的框架问题
tkinter怎么设置框架中的组件居左,但是又不让另外的组件跟在这个组件的后面? 用Place布局 可以用grid方法, 所有的column = 1e.g.
w.grid(row = 0,column =1)
w.grid(row = 1,column =1)
。。。 pythonsean 发表于 2020-12-18 14:52
可以用grid方法, 所有的column = 1
e.g.
w.grid(row = 0,column =1)
谢谢,学会了。但这个又出现了一个新的问题:
from tkinter import *
root = Tk()
root.geometry('600x600')
header = Frame()
mid = Frame()
footer = Frame()
font = (None, 15)
text = Label(header, text = 'name:', font = font)
text.grid(row = 0, column = 1, sticky = W)
enter = Text(header, height = 1, font = font)
enter.grid(row = 0, column = 2)
inti = IntVar()
choose = Checkbutton(header, text = 'I want to set a password', variable = inti, font = font)
choose.grid(row = 2, column = 1, pady = 20)
header.pack()
mainloop()
这个text组件和label组件差的很远设置pady也没用,请问要怎么解决? 这是因为你的checkbutton控件将第一列撑大了,可以用columnspan option调整
from tkinter import *
root = Tk()
root.geometry('600x600')
header = Frame()
mid = Frame()
footer = Frame()
font = (None, 15)
text = Label(header, text = 'name:', font = font)
text.grid(row = 0, column = 1, sticky = W)
enter = Text(header, height = 1, font = font)
enter.grid(row = 0, column = 2)
inti = IntVar()
choose = Checkbutton(header, text = 'I want to set a password', variable = inti, font = font)
choose.grid(row = 2, column = 1, columnspan = 2,sticky = 'w',pady = 20,padx = 30)
header.pack()
mainloop() pythonsean 发表于 2020-12-19 10:36
这是因为你的checkbutton控件将第一列撑大了,可以用columnspan option调整
from tkinter import *
谢谢,帮助很大
页:
[1]