本文整理汇总了Python中gui.Gui.mainloop方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.mainloop方法的具体用法?Python Gui.mainloop怎么用?Python Gui.mainloop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.Gui
的用法示例。
在下文中一共展示了Gui.mainloop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: elif
# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import mainloop [as 别名]
print '\n\n Highest emotion: ' + highest + '\n\n'
print 'Accumulated so far: '
print tweetprocessor.counts
# logger.logCounts(tweetprocessor.counts)
print '\n\n'
if (highest == 'happy'):
gui.setColor('green')
elif (highest == 'angry'):
gui.setColor('red')
elif (highest == 'sad'):
gui.setColor('blue')
elif (highest == 'profane'):
gui.setColor('orange')
# Do process again after 15 sec
_job = gui.after(QUERY_FREQ, searchEvent)
def quitCallback():
print "Exited."
gui.stopGui()
def get_string():
search_text = gui.search.get()
if len(search_text) > 0:
return search_text
if __name__ == '__main__':
gui = Gui(quitCallback,get_string)
_job = gui.after(QUERY_FREQ, searchEvent)
gui.mainloop()
示例2: BatMonTh
# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import mainloop [as 别名]
class BatMonTh(Thread):
def __init__(self):
Thread.__init__(self)
self.count = 0
self.voltage = 0
self.state = "idle"
self.batNb = int(input("Entrez le numéro de la batterie :"))
self.fileName = ""
self.com = BatMon()
self.com.setPort('COM12')
self.verrou = Lock()
self.gui = Gui(self.verrou)
self.start()
self.gui.mainloop()
def run(self):
appRunning = True
while (appRunning):
self.voltage = 0
if (self.state == "idle"):
if (self.com.connect()):
if (self.com.getId()):
self.count = 0
self.state = "connected"
self.file = self.createFile()
else:
time.sleep(0.5)
else:
time.sleep(0.5)
else:
data = self.com.getData()
self.voltage = data[0]
self.state = data[1]
self.count += 1
if (self.count > 32767):
self.count = -32768
if (self.state == "idle"):
try:
self.file.close()
except:
self.fileName = ''
elif ((self.state == "discharging") and (self.count%60==0)):
if (self.verrou.acquire(False)):
self.gui.addData(self.count, self.voltage)
self.verrrou.release()
else:
appRunning = False
pickle.dump(self.count, self.file)
pickle.dump(self.voltage, self.file)
if (self.verrou.acquire(False)):
self.gui.changeVoltage(self.voltage)
self.gui.changeState(self.state)
self.verrou.release()
else:
appRunning = False
try:
self.file.close()
except:
self.fileName = ''
def createFile(self):
fileNb = 0
success = False
while(not(success)):
try:
self.fileName = "Bat%02i-%03i.BDi" % (self.batNb, fileNb)
open(self.fileName,'rb')
fileNb += 1
except:
success = True
newFile = open(self.fileName, 'wb')
return newFile