本文整理汇总了Python中tkinter.Tk.grid方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.grid方法的具体用法?Python Tk.grid怎么用?Python Tk.grid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Tk
的用法示例。
在下文中一共展示了Tk.grid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: showMainValues
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import grid [as 别名]
def showMainValues():
global tkroot
global labels
global mframe
global values
from tkinter import Tk, N, W
from tkinter.ttk import LabelFrame, Label
# first run, set up the thingy
print("Setting up Main Values...")
init_parse(getMainValues, _parse_main_values_xml, values)
sleep(0.5)
print("Setting up Advanced Values...")
init_parse(getAdvancedValues, _parse_adv_values_xml, values)
print("initializing tkinter interface...")
tkroot = Tk()
mframe = LabelFrame(tkroot, text="Main Frame")
labels = {}
for group in values:
lframe = LabelFrame(mframe, text=group)
labels[group] = OrderedDict()
labels[group]['frame'] = lframe
for param, pv in values[group].items():
labels[group][param] = {}
plabel = Label(lframe, text=param)
vlabel = Label(lframe, text=pv)
labels[group][param]['plabel'] = plabel
labels[group][param]['vlabel'] = vlabel
mframe.grid()
for i, group in enumerate(labels):
for param in labels[group]:
if param == 'frame':
labels[group][param].grid(column=i, row=0, sticky=N)
else:
labels[group][param]['plabel'].grid(sticky=W)
labels[group][param]['vlabel'].grid(sticky=W)
tkroot.grid()
print('setting up polling intervals')
tkroot.after(500, poll_main_values)
tkroot.after(750, poll_adv_values)
print('Ready')
tkroot.mainloop()
print("afterloop")
示例2: reklaam_start
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import grid [as 别名]
def reklaam_start(taust):
"""Close the previous window and create a new one for the commercial.
The previous window will be closed after the button is pressed. Pictures
are made for functions and functions are called out for the commercial.
"""
taust.destroy()
aken = Tk()
aken.title("Reklaam")
aken.geometry("720x480")
aken["bg"] = "Blue"
vana_pilt = PhotoImage(file="jouluvana_saanis.png")
vana_pilt = vana_pilt.subsample(4, 4)
lume_pilt = PhotoImage(file="snowflake.png")
lume_pilt = lume_pilt.subsample(25, 25)
kingi_pilt = PhotoImage(file="gift.png")
kingi_pilt = kingi_pilt.subsample(15, 15)
aken.grid()
pilve_list = pilve_pildid()
loo_pilv(aken, pilve_list, 7)
jouluvana(aken, vana_pilt)
loo_lumi(aken, lume_pilt, kingi_pilt)
aken.mainloop()
示例3: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import grid [as 别名]
def __init__(self, server):
root = Tk()
root.grid()
示例4: notify
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import grid [as 别名]
self.myExpensesScrollbar.destroy()#pack(side='right',fill='y') #5
self.scrolBarAcrive = False
def notify(self):
''' Get the value from each question to display them on screen '''
self.total['text'] = str(self.reader.displayTotalSum())
def quitMessage(self,):
'''Exit programme'''
message = messagebox.askyesno(title="Quit", message="Are you sure want to exit?",icon= "warning")
if message:
top.destroy() # On Yes exits application.
if __name__ == "__main__":
top =Tk()
top.configure(bg="white")
user32=ctypes.windll.user32
screenSize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
width=screenSize[0]
height=screenSize[1]
top.geometry(str(width)+"x"+str(height))
top.title("LSBU Informatic Faculty")
top.grid()
app = TaskGUI(top,height,width)
top.mainloop()