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


Python Window.mainloop方法代码示例

本文整理汇总了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()
开发者ID:acadet,项目名称:groopster,代码行数:54,代码来源:boot.py

示例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()
			
		


开发者ID:tjreed15,项目名称:CaptureTheFlag,代码行数:28,代码来源:client.py

示例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()
开发者ID:karidon,项目名称:TheEndOfTheDay,代码行数:23,代码来源:main.py

示例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()
开发者ID:vhf,项目名称:pattirc,代码行数:17,代码来源:pattirc.py

示例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 ---
开发者ID:davidcox,项目名称:glumpy,代码行数:70,代码来源:figure.py


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