本文整理汇总了Python中tkinter.Label.update方法的典型用法代码示例。如果您正苦于以下问题:Python Label.update方法的具体用法?Python Label.update怎么用?Python Label.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Label
的用法示例。
在下文中一共展示了Label.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SliderFrequency
# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import update [as 别名]
class SliderFrequency(Frame):
def __init__(self,root, freq, val, Min=0.0, Max=1.0, sId=0):
Frame.__init__(self,root)
self.root = root
self.id = sId
self.freq = freq
self.min = Min
self.max = Max
self.gain = StringVar()
self.gain.set(val)
self.value = StringVar()
self.value.set( str(self._Gain(val))+" dB")
self.initialize()
self.gain.set(self._Gain(val))
def initialize(self):
self.slider = Scale(self.root, orient=VERTICAL, from_=self.min, to=self.max, value=float(self.gain.get()), command=self._updateValue)
self.slider.grid(row=0,column=self.id, padx=10)
self.valueLbl = Label(self.root, anchor="w", textvariable=self.value)
self.valueLbl.grid(row=1,column=self.id, padx=10)
self.freqLbl = Label(self.root,text=str(self.freq)+" Hz")
self.freqLbl.grid(row=2,column=self.id, padx=10)
def _updateValue(self,event):
self.gain.set(self._Gain(self.slider.get()))
self.value.set(str(self.gain.get())+" dB")
self.valueLbl.update()
def _Gain(self, value):
v = -(float(value)-((self.max-self.min)/2))
v = int(v*10)/10
return v
def getGain(self):
return float(self.gain.get())
示例2: SliderFrequency
# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import update [as 别名]
class SliderFrequency(Frame):
"""
A slider with label wich indicate the gain in dB and Frequency in Hz
parameters:
root: Canvas
the canvas to place the slider
freq: float
the frequency in Hz
val: float
initial value of the slider
Min: float
the min value of the slider
Max: float
the maximum of value of the slider
sId: int
the ID of the slider
"""
def __init__(self,root, freq, val, Min=0.0, Max=1.0, sId=0):
Frame.__init__(self,root)
self.root = root
self.id = sId
self.freq = freq
self.min = Min
self.max = Max
self.gain = StringVar()
self.gain.set(self._Gain(val))
self.value = StringVar()
self.value.set( str(val)+" dB")
self.initialize()
self.gain.set(self._Gain(val))
def initialize(self):
""" Initialize the slider and the label"""
self.slider = Scale(self.root, orient=VERTICAL, from_=self.min, to=self.max, value=float(self.gain.get()), command=self._updateValue)
self.slider.grid(row=0,column=self.id, padx=14)
self.valueLbl = Label(self.root, anchor="w", textvariable=self.value)
self.valueLbl.grid(row=1,column=self.id, padx=14)
self.freqLbl = Label(self.root,text=str(self.freq)+" Hz")
self.freqLbl.grid(row=2,column=self.id, padx=14)
def _updateValue(self,event):
""" update the gain value and label when the slider is changing """
self.gain.set(self.slider.get())
self.value.set(str(self._Gain(self.gain.get()))+" dB")
self.valueLbl.update()
def _Gain(self, value):
""" Transform the value of the slider to correct gain value """
v = (((self.max-self.min))-float(value))
v = int(v*10)/10.0
return v
def getGain(self):
""" Return the gain """
return float(self._Gain(self.gain.get()))
def getFrequency(self):
""" Return the frequency """
return self.freq
示例3: GUI
# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import update [as 别名]
#.........这里部分代码省略.........
#############################################################
for x in range(8,13,1): ###set the label name
self.InTimeFutureLabel = Label()
self.InTimeFutureLabel["text"]=self.LabelName[x-8]
self.InTimeFutureLabel.grid(row=0,column=x)
self.ThreeMenDollar()
self.PrintFeautre()
# self.InTimeObject.GetInTimeStockInfo(2330)
####################### initial interface #######################
self.interface.after(1000,self.PrintInTime)
self.interface.mainloop()
#
def mmka(self):
while True:
self.InTimeObject.FutureInTime()
self.HighSatisfy.set(self.InTimeObject.PowerStage+self.InTimeObject.MiddleStage)
self.showPowerStage.set(self.InTimeObject.WeakStage+self.InTimeObject.MiddleStage)
self.showMiddleStage.set(self.InTimeObject.MiddleStage)
self.showWeakStage.set(self.InTimeObject.MiddleStage-self.InTimeObject.WeakStage)
self.LowSatisfy.set(self.InTimeObject.MiddleStage-self.InTimeObject.PowerStage)
self.showClosePrice.set(self.InTimeObject.FutureNowPrice)
self.LabelHighSatisfy["text"]=self.HighSatisfy.get()
self.LabelPower["text"] = self.showPowerStage.get()
self.LabelMiddle["text"]=self.showMiddleStage.get()
self.LabelWeak["text"]=self.showWeakStage.get()
self.LabelLowSatisfy["text"]=self.LowSatisfy.get()
self.LabelClose["text"]=self.showClosePrice.get()
self.LabelHighSatisfy.update()
self.LabelLowSatisfy.update()
self.LabelMiddle.update()
self.LabelPower.update()
self.LabelWeak.update()
self.LabelClose.update()
time.sleep(1)
def PrintInTime(self):
self.PrintFeautre_thread = threading.Thread(target=self.mmka)
self.PrintFeautre_thread.start()
def tesfile(self,event):
count =0
f = open("export.csv","r")
for row in csv.reader(f):
# print(row)
count+=1
if count >=4 and (row[2]!='-' and float(row[2])<=self.TargetPERatio):
QueryPrice=Share(row[0]+'.TW')
# volumetemp = self.InTimeObject.GetInTimeStockInfo(row[0])
# print(volumetemp)
if QueryPrice.get_earnings_share()!=None and float(QueryPrice.get_earnings_share())>=self.TargetEPS and float: #float(QueryPrice.get_earnings_share())>=self.TargetEPS:
if float(QueryPrice.get_volume())>=self.TargetVolume and float(QueryPrice.get_price())<=self.TargetPrice:
information = row[0] + row[1]+"\t" + QueryPrice.get_earnings_share() +" "+ QueryPrice.get_volume()+" " + QueryPrice.get_price()
self.ThreemenBox.insert(END,information)
if count==50:
break
def PrintFeautre(self):
temp=[]
for item in csv.reader(codecs.iterdecode(self.TodayFutureResponse,"Latin-1")):