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


Python Label.update_idletasks方法代码示例

本文整理汇总了Python中tkinter.Label.update_idletasks方法的典型用法代码示例。如果您正苦于以下问题:Python Label.update_idletasks方法的具体用法?Python Label.update_idletasks怎么用?Python Label.update_idletasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter.Label的用法示例。


在下文中一共展示了Label.update_idletasks方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: StatusBar

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import update_idletasks [as 别名]
class StatusBar(Frame):
    def __init__(self, master):
        Frame.__init__(self, master)
        self.label = Label(self, borderwidth=1, relief=SUNKEN, anchor=E)
        self.label.pack(fill=X)

    def set(self, format, *args):
        self.label.config(text=format % args)
        self.label.update_idletasks()

    def clear(self):
        self.label.config(text="")
        self.label.update_idletasks()
开发者ID:tarekauel,项目名称:umundo-java,代码行数:15,代码来源:statusbar.py

示例2: __init__

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import update_idletasks [as 别名]
class GUI:

	def __init__(self, main):
		main.protocol("WM_DELETE_WINDOW", self.onClose)
		self.main = main
		main.title("Redeploy script that Actually Works")

		wildFlyLocationLabel = Label(main, text="Wildfly location path", font=("Ubuntu", 18))
		wildFlyLocationLabel.pack()

		self.wildFlyLocation = Entry(main, font=("Ubuntu", 18))
		self.wildFlyLocation.pack()

		buildArgsLabel = Label(main, text="Maven muikku profile", font=("Ubuntu", 18))
		buildArgsLabel.pack()

		self.buildArgs = Entry(main, font=("Ubuntu", 18))
		self.buildArgs.pack()

		self.runButton = Button(main, text="run", command=self.run, font=("Ubuntu", 18))
		self.runButton.pack()

		#self.mavenBuildButton = Button(main, text="Maven build", command=self.mavenBuild, font=("Ubuntu", 18))
		#self.mavenBuildButton.pack()

		#self.mavenPyramusBuildButton = Button(main, text="Maven pyramus build", command=self.mavenPyramusBuild, font=("Ubuntu", 18))
		#self.mavenPyramusBuildButton.pack()

		#self.deployButton = Button(main, text="Deploy", command=self.deployMuikku, font=("Ubuntu", 18))
		#self.deployButton.pack()

		#self.deployPyramusButton = Button(main, text="Deploy pyramus", command=self.deployPyramus, font=("Ubuntu", 18))
		#self.deployPyramusButton.pack()

		#self.ultraDupaClean = Button(main, text="Ultra dupa clean and deploy", command=self.ultraDupaClean, font=("Ubuntu", 18))
		#self.ultraDupaClean.pack()


		self.status = StringVar()
		self.statusLabel = Label(main, textvariable=self.status, font=("Ubuntu", 18))
		self.statusLabel.pack()

		self.getValues()

		#self.startWildfly()

		self.setStatus("Ready")

	def onClose(self):
		self.stopWildfly();
		self.main.destroy();

	def getValues(self):
		try:
			self.setStatus("Reading Config...")
			file = open("./rconfig", "r")
			readFile = file.read();
			self.wildFlyLocation.insert(0, readFile.split("\n")[0])
			self.buildArgs.insert(0, readFile.split("\n")[1])
			file.close()
		except:
			pass

	def setStatus(self, text):
		self.status.set(text)
		self.statusLabel.update_idletasks()

	def startWildfly(self):
		wildFlyLocation = self.wildFlyLocation.get()
		self.wildFlyProcess = subprocess.Popen([wildFlyLocation + "/bin/standalone.sh"], shell=True, preexec_fn=os.setsid);

	def stopWildfly(self):
		self.wildFlyProcess.kill()
		os.killpg(self.wildFlyProcess.pid, signal.SIGTERM)

	def mavenBuild(self):
		self.setStatus("Building...");
		self.save();
		process = ["mvn", "clean", "install", "-f", "../../../../../../../../pom.xml"]
		buildArgs = self.buildArgs.get();
		if (buildArgs):
			process.append("-P" + buildArgs)
		subprocess.call(process)
		self.deployMuikku()
		self.setStatus("Ready")

	def mavenPyramusBuild(self):
		self.setStatus("Building...");
		self.save();
		process = ["mvn", "clean", "install", "-f", "../../../../../../../../../pyramus/pom.xml"]
		subprocess.call(process)
		self.deployPyramus()
		self.setStatus("Ready")

	def deployMuikku(self):
		mName = [f for f in os.listdir(expanduser("~/.m2/repository/fi/otavanopisto/muikku/muikku")) if os.path.isdir(expanduser("~/.m2/repository/fi/otavanopisto/muikku/muikku/" + f)) and f.endswith("SNAPSHOT")][0]
		mNameActual = [f for f in os.listdir(expanduser("~/.m2/repository/fi/otavanopisto/muikku/muikku/" + mName)) if os.path.isfile(expanduser("~/.m2/repository/fi/otavanopisto/muikku/muikku/" + mName + "/" + f)) and f.endswith(".war")][0];
		self.deploy(expanduser("~/.m2/repository/fi/otavanopisto/muikku/muikku/" + mName + "/" + mNameActual), mNameActual)

	def deployPyramus(self):
#.........这里部分代码省略.........
开发者ID:otavanopisto,项目名称:muikku,代码行数:103,代码来源:rdeploy.py

示例3: ConfigurationWindow

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import update_idletasks [as 别名]

#.........这里部分代码省略.........
        """
        super(ConfigurationWindow, self).__init__(parent)
        self._bike = None
        self.parent = parent
        self.frames = frames
        self.forks = forks
        self.wheelsets = wheelsets
        self.groups = groups
        self.components = components
        self.parent.title("Bicycle configurator")
        self._bike_price = StringVar(self.parent)
        self._bike_weight = StringVar(self.parent)
        self._bike_travel = StringVar(self.parent)
        self.price_label = Label(self.parent, textvariable=self._bike_price)
        self.weight_label = Label(self.parent, textvariable=self._bike_weight)
        self.travel_label = Label(self.parent, textvariable=self._bike_travel)

        self.createInterface()
        self.createBike()

        self.price_label.pack()
        self.weight_label.pack()
        self.travel_label.pack()
        
        self.pack(fill=BOTH, expand=1)
        
    def createInterface(self):
        """
        Tworzenie interfejsu - nieistotne dla idei zadania
        """
        self.frame_choice = StringVar(self.parent)
        self.frame_choice.set(tuple(self.frames.keys())[0])
        self.frame_choice.trace("w", self.createBike)
        self.frame_options = OptionMenu(self.parent,self.frame_choice,
                                        *self.frames.keys())
        Label(self.parent,text="Rama:").pack()
        self.frame_options.pack(fill=BOTH, expand=1)

        self.fork_choice = StringVar(self.parent)
        self.fork_choice.set(tuple(self.forks.keys())[0])
        self.fork_choice.trace("w", self.createBike)
        self.fork_options = OptionMenu(self.parent,self.fork_choice,
                                        *self.forks.keys())
        Label(self.parent,text="Widelec:").pack()
        self.fork_options.pack(fill=BOTH, expand=1)

        self.wheelset_choice = StringVar(self.parent)
        self.wheelset_choice.set(tuple(self.wheelsets.keys())[0])
        self.wheelset_choice.trace("w", self.createBike)
        self.wheelset_options = OptionMenu(self.parent,self.wheelset_choice,
                                        *self.wheelsets.keys())
        Label(self.parent,text="Koła:").pack()
        self.wheelset_options.pack(fill=BOTH, expand=1)

        self.group_choice = StringVar(self.parent)
        self.group_choice.set(tuple(self.groups.keys())[0])
        self.group_choice.trace("w", self.createBike)
        self.group_options = OptionMenu(self.parent,self.group_choice,
                                        *self.groups.keys())
        Label(self.parent,text="Grupa osprzętu:").pack()
        self.group_options.pack(fill=BOTH, expand=1)

        self.components_choice = StringVar(self.parent)
        self.components_choice.set(tuple(self.components.keys())[0])
        self.components_choice.trace("w", self.createBike)
        self.components_options = OptionMenu(self.parent,self.components_choice,
                                        *self.components.keys())
        Label(self.parent,text="Komponenty:").pack()
        self.components_options.pack(fill=BOTH, expand=1)

    def createBike(self, *args):
        """
        Metoda tworząca obiekt roweru na zasadanie dekorowania
        obiektu klasy 'Frame'
        """
        frame = self.frames[self.frame_choice.get()]
        
        fork = self.forks[self.fork_choice.get()]
        fork.decorated = frame
        
        wheelset = self.wheelsets[self.wheelset_choice.get()]
        wheelset.decorated = fork
        
        group = self.groups[self.group_choice.get()]
        group.decorated = wheelset
        
        components = self.components[self.components_choice.get()]
        components.decorated = group
        self._bike = components

        # przypisanie wartości odpowiednim elementom GUI       
        self._bike_price.set("cena: " + str(self._bike.price) + "zł")
        self._bike_weight.set("waga: " + str(self._bike.weight) + " gr")
        self._bike_travel.set("skok: " + str(self._bike.travel) + " mm")

        # uaktualnienie okna
        self.price_label.update_idletasks()
        self.weight_label.update_idletasks()
        # zmiana tytułu okna
        self.parent.wm_title(self._bike.name)
开发者ID:kpiszczek,项目名称:wzorceuj,代码行数:104,代码来源:cw5b.py


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