本文整理汇总了Python中window.Window.mainloop方法的典型用法代码示例。如果您正苦于以下问题:Python Window.mainloop方法的具体用法?Python Window.mainloop怎么用?Python Window.mainloop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类window.Window
的用法示例。
在下文中一共展示了Window.mainloop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import mainloop [as 别名]
class Boot:
def __init__(self):
self.__threads = 0
self.__lock = Lock()
def start(self):
self.__window = Window(self)
self.__window.build()
self.__window.mainloop()
###
# Run when copying thread has encountered an error
###
def onCopyError(self, error):
print(traceback.format_exc(error))
self.__window.showError(error)
###
# Run when copying thread has ended
###
def onCopyEnd(self):
with self.__lock:
self.__threads -= 1
if self.__threads is 0:
# No more thread, copying engine has ended
self.__window.showSuccess()
###
# Called when user has launched system
###
def onRun(self, srcDir, targetDir, method):
# First: build file trees
originalTree = FileTree(srcDir)
targetTree = FileTree(targetDir)
originalTree.build()
targetTree.build()
# Now, launch copying engine
if method is '0':
copyEngine = CopyEngine(self, lambda x, y: True)
else:
copyEngine = CopyEngine(self, lambda x,y: x.getLatestEdition() > y.getLatestEdition())
outcome = copyEngine.run(srcDir, originalTree, targetDir, targetTree)
with self.__lock:
self.__threads += outcome
if self.__threads is 0:
# Copy engine has ended after copying threads, process is over
self.__window.showSuccess()
示例2: len
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import mainloop [as 别名]
if not len(sys.argv) in [3]:
print 'Usage: python {} HOST PORT'.format(sys.argv[0])
sys.exit(1)
host = sys.argv[1]
port = int(sys.argv[2])
# Create socket and bind to local host and given port
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, port))
except socket.error as msg:
print 'Connection failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
sys.exit()
# Create a window
window = Window(sock)
# Create new client obj with the socket and window
client = Client(sock, window)
# Start listening for server data
start_new_thread(client.recieve_data, ())
# Start graphics loop
window.mainloop()
示例3: Window
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import mainloop [as 别名]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
__author__ = 'karidon'
__email__ = '[email protected]'
__date__ = '2016-04-04'
from window import ApplicationTop, ApplicationExpand
from window import ApplicationBottom, ApplicationBottomDown
from window import Window, ApplicationDownClock
if __name__ == '__main__':
root = Window() # TK()
app_top = ApplicationTop(master=root) # Frame Top
app_expand = ApplicationExpand(master=root) # Frame Expand
app_top_right = ApplicationDownClock(master=root) # Frame Bottom Clock
app_bottom = ApplicationBottom(master=root) # Frame Bottom
app_bottom_down = ApplicationBottomDown(master=root) # Frame Bottom Down
root.mainloop()
示例4: Window
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import mainloop [as 别名]
#!/usr/bin/python2
import sys
sys.path.append('./pattirc')
import ConfigParser
from window import Window
if __name__ == '__main__':
cp = ConfigParser.ConfigParser()
cp.read("config.cfg")
at = cp.get("general", "access_token")
w = Window(access_token=at)
w.mainloop()
示例5: Figure
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import mainloop [as 别名]
#.........这里部分代码省略.........
self.parent._figures.append(frame)
self._aspect = aspect
return frame
# --------------------------------------------------------------- clear ---
def clear(self, red=1, green=1, blue=1, alpha=1):
'''
Clear the current figure with given color.
:Parameter:
``red``: float
Red component
``green``: float
Green component
``blue``: float
Blue component
``alpha``: float
Alpha component (transparency)
'''
gl.glClearColor(red,green,blue,alpha)
gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
# ---------------------------------------------------------------- show ---
def show(self):
'''
Show all figures and enter the mainloop.
'''
if self.parent is not None:
self.parent.show()
return
self._root.mainloop()
# ---------------------------------------------------------------- show ---
def draw(self):
'''
Show all figures and enter the mainloop.
'''
self.root.draw()
# ---------------------------------------------------------------- push ---
def push(self, obj):
'''
Push object handlers onto the event stack
:Parameters:
``obj``: object
Object to be pushed onto the event stack
'''
self.push_handlers(obj)
# ---------------------------------------------------------------- push ---