本文整理汇总了Python中Tkinter.Tk.grid方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.grid方法的具体用法?Python Tk.grid怎么用?Python Tk.grid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Tk
的用法示例。
在下文中一共展示了Tk.grid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_pixels
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import grid [as 别名]
def get_pixels():
root = Tk()
root.title("Pixel Printer")
root.grid()
inner_top = Frame(root)
inner_top.grid(row=0, column=0)
t1 = Entry(inner_top, width = 40)
t2 = Entry(inner_top, width = 40)
v = StringVar()
root.columnconfigure(0, weight=1)
root.columnconfigure(1, weight=1)
b1 = Button(inner_top, text = "Source")
b2 = Button(inner_top, text = "Dest")
b3 = Button(inner_top, text = "Calc")
b1.configure(command= lambda:get_source(t1))
b2.configure(command= lambda:get_dest(t2))
b3.configure(command= lambda:calculate(t1, t2, v))
t1.grid(row=0, column=0)
b1.grid(row=0, column=1, sticky=E+W)
t2.grid(row=1, column=0)
b2.grid(row=1, column=1, sticky=E+W)
b3.grid(row=2, column=1, sticky=E+W)
root.mainloop()
示例2:
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import grid [as 别名]
nB_label.grid(row=3,column=0, padx=5,pady=5)
nB_entry.grid(row=3, column=1, padx=5,pady=5)
fitType_label.grid(row=4,column=0, padx=5,pady=5)
fitType_frame.grid(row=4,column=1, padx=5,pady=5)
niter_label.grid(row=5,column=0, padx=5,pady=5)
niter_entry.grid(row=5,column=1, padx=5,pady=5)
nobinning_label.grid(row=6,column=0)
nobinning_check.grid(row=6,column=1)
p_label.grid(row=7,column=0, padx=5,pady=5)
p_entry.grid(row=7,column=1, padx=5,pady=5)
fbL_label.grid(row=8,column=0, padx=5,pady=5)
fbL_entry.grid(row=8,column=1, padx=5,pady=5)
fbH_label.grid(row=9,column=0, padx=5,pady=5)
fbH_entry.grid(row=9,column=1, padx=5,pady=5)
binchoice_label.grid(row=10,column=0, padx=5,pady=5)
binchoice_frame.grid(row=10,column=1, padx=5,pady=5)
fQ_label.grid(row=11,column=0, padx=5,pady=5)
fQ_entry.grid(row=11,column=1, padx=5,pady=5)
outID_label.grid(row=12,column=0, padx=5,pady=5)
outID_entry.grid(row=12,column=1, padx=5,pady=5)
submit_button.grid(row=14,column=0, padx=5,pady=5, columnspan=2, sticky='nsew')
progress_label.grid(row=15,column=0, padx=5,pady=5, columnspan=2)
reset_button.grid(row=17,column=0, padx=5,pady=5, sticky='nsew')
help_button.grid(row=17,column=1, padx=5,pady=5, sticky='nsew')
root.grid()
# -- set scaling and run --
root.columnconfigure(0, weight=1)
root.columnconfigure(1, weight=1)
root.mainloop()