当前位置: 首页>>代码示例>>Python>>正文


Python Toplevel.update_idletasks方法代码示例

本文整理汇总了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)
开发者ID:SirRujak,项目名称:SirBot,代码行数:53,代码来源:splash.py

示例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
开发者ID:matty-l,项目名称:Lilac,代码行数:52,代码来源:Module.py


注:本文中的tkinter.Toplevel.update_idletasks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。