本文整理汇总了Python中tkinter.Toplevel.update_idletasks方法的典型用法代码示例。如果您正苦于以下问题:Python Toplevel.update_idletasks方法的具体用法?Python Toplevel.update_idletasks怎么用?Python Toplevel.update_idletasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Toplevel
的用法示例。
在下文中一共展示了Toplevel.update_idletasks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: splash
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import update_idletasks [as 别名]
class splash():
# try:
def __init__(self):
moduleDir = dirname(__file__)
moduleDir = moduleDir.rsplit('\\',2)[0]
image = moduleDir+'\\resources\\sirbot\\splash.gif'
self.root = Tk()
self.root.withdraw()
self.loadingSplash = Toplevel()
splashimage = PhotoImage(file=image)
self.loading = ttk.Label(self.loadingSplash,image=splashimage)
self.loadingSplash.overrideredirect(True)
self.loading.pack()
h = self.loading.winfo_screenheight()
w = self.loading.winfo_screenwidth()
self.loadingSplash.wm_attributes('-alpha',0.75)
self.loadingSplash.update_idletasks()
self.loadingSplash.geometry('262x112+'+str(int(w/2)-131*1)+
'+'+str(int(h/2)-56*1))
self.loadingSplash.update_idletasks()
self.loadingSplash.update()
# except:
## #log
## loadingSplash = Tk()
## #myfont = tkFont.families()[0]
## loading = Label(loadingSplash,text='SirBot')
## loadingSplash.overrideredirect(True)
## loading.pack()
##
## h = loading.winfo_screenheight()
## w = loading.winfo_screenwidth()
##
## loadingSplash.wm_attributes('-alpha',0.75)
## loadingSplash.update_idletasks()
## loadingSplash.geometry('262x112+'+str(int(w/2)-131*1)+
## '+'+str(int(h/2)-56*1))
## loadingSplash.update_idletasks()
## loadingSplash.update()
def destroy(self):
try:
self.loadingSplash.destroy()
except:
#log
pass
def getroot(self):
return(self.root)
示例2: average_normals
# 需要导入模块: from tkinter import Toplevel [as 别名]
# 或者: from tkinter.Toplevel import update_idletasks [as 别名]
def average_normals( self ):
""" Applies Gouraud normalization to the module
"""
# Set up updater
top = Toplevel()
pb = Progressbar(top,orient ="horizontal",length = 200, mode ="determinate")
pb['maximum'] = len(self.__elements__)
pb['value'] = 10
pb.grid(row=0,column=0)
tx = Label(top)
tx.grid(row=1,column=0)
top.update_idletasks()
top.lift()
t0 = time.time()
# run the loop, if we're visible and phong shading
if not self.invisible == 'gouroud':
try:
buf = np.array([0,0,0,1])
for i,polygon in enumerate(self.__elements__):
if not ispoly(polygon): continue
polygon._onorms = np.array([polygon.normals.astype(float)+buf for i in range(len(polygon.coordinates))])
# Update the user as to what's going on
if i % 50 == 0 and i > 0:
pb['value'] = i
tmp = i/len(self.__elements__)
estimation = int(tmp*(time.time()-t0) * (1-tmp)/tmp)
tx.configure(text=str(int(100*i/len(self.__elements__)))+"%"+' Estimated time: '+str(estimation)+'s' )
top.update_idletasks()
for c,coordinate in enumerate(polygon.coordinates):
for j,opolygon in enumerate(self.__elements__):
if i == j or not ispoly(opolygon): continue
for k,ocoordinate in enumerate(opolygon.coordinates):
if all(coordinate == ocoordinate): # same vertex, finally
polygon._onorms[c] += (opolygon.normals+buf)
polygon._onorms /= polygon._onorms[:,3,None]
for polygon in self.__elements__:
if ispoly(polygon):
polygon.normals = polygon._onorms
del polygon._onorms
except IndexError as ie: pass
top.destroy()
if self.invisible == 'gouroud':
self.invisible = False
return self # for chaining