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


Python tkinter.mainloop方法代码示例

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


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

示例1: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def __init__(self):
        self.root = tkinter.Tk()
        self.root.title("Mandelbrot (Pyro multi CPU core version)")
        canvas = tkinter.Canvas(self.root, width=res_x, height=res_y, bg="#000000")
        canvas.pack()
        self.img = tkinter.PhotoImage(width=res_x, height=res_y)
        canvas.create_image((res_x/2, res_y/2), image=self.img, state="normal")
        with locate_ns() as ns:
            mandels = ns.yplookup(meta_any={"class:mandelbrot_calc_color"})
            mandels = list(mandels.items())
        print("{0} mandelbrot calculation servers found.".format(len(mandels)))
        if not mandels:
            raise ValueError("launch at least one mandelbrot calculation server before starting this")
        self.mandels = [uri for _, (uri, meta) in mandels]
        self.pool = futures.ThreadPoolExecutor(max_workers=len(self.mandels))
        self.tasks = []
        self.start_time = time.time()
        for line in range(res_y):
            self.tasks.append(self.calc_new_line(line))
        self.root.after(100, self.draw_results)
        tkinter.mainloop() 
开发者ID:irmen,项目名称:Pyro5,代码行数:23,代码来源:client_graphics.py

示例2: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def __init__(self, control, board):
        self.control = control
        if self.control.game_mode != 2:
            self.can.bind('<Button-1>', self.control.callback)

        self.lb = tkinter.Listbox(ChessView.root,selectmode="browse")
        self.scr1 = tkinter.Scrollbar(ChessView.root)
        self.lb.configure(yscrollcommand=self.scr1.set)
        self.scr1['command'] = self.lb.yview
        self.scr1.pack(side='right',fill="y")
        self.lb.pack(fill="x")

        self.lb.bind('<<ListboxSelect>>', self.printList)  # Double-    <Button-1>
        self.board = board
        self.last_text_x = 0
        self.last_text_y = 0
        self.print_text_flag = False

    # def start(self):
    #     tkinter.mainloop() 
开发者ID:chengstone,项目名称:cchess-zero,代码行数:22,代码来源:ChessView.py

示例3: start

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def start(self):
        if self.control.game_mode == 2:
            self.root.update()
            time.sleep(self.control.delay)
            while True:
                game_end = self.control.game_mode_2()
                self.root.update()
                time.sleep(self.control.delay)
                if game_end:
                    time.sleep(self.control.end_delay)
                    self.quit()
                    return
        else:
            tkinter.mainloop()
            # self.root.mainloop()

    # below added by Fei Li 
开发者ID:chengstone,项目名称:cchess-zero,代码行数:19,代码来源:ChessView.py

示例4: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def __init__(self):
        self.root = tkinter.Tk()
        self.root.title("Mandelbrot (Single CPU core)")
        canvas = tkinter.Canvas(self.root, width=res_x, height=res_y, bg="#000000")
        canvas.pack()
        self.img = tkinter.PhotoImage(width=res_x, height=res_y)
        canvas.create_image((res_x/2, res_y/2), image=self.img, state="normal")
        self.mandel = MandelbrotColorPixels()
        self.start_time = time.time()
        self.root.after(1000, lambda: self.draw_line(0))
        tkinter.mainloop() 
开发者ID:irmen,项目名称:Pyro5,代码行数:13,代码来源:normal_graphics.py

示例5: launchButton2App

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def launchButton2App():
    root = tk.Tk()
    Button2App(root)
    tk.mainloop() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:6,代码来源:program5.py

示例6: DisplayAppLaunch

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def DisplayAppLaunch():
    root = tk.Tk()
    DisplayApp(root)
    tk.mainloop() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:6,代码来源:program9.py

示例7: launchEntryApp

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def launchEntryApp():
    root = tk.Tk()
    entryApp(root)
    tk.mainloop() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:6,代码来源:program6.py

示例8: launchApp

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def launchApp():
    root = tk.Tk()
    App(root)
    tk.mainloop() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:6,代码来源:program13.py

示例9: launchNoteBookApp

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def launchNoteBookApp():
    root = tk.Tk()
    NoteBookApp(root)
    tk.mainloop() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:6,代码来源:program12.py

示例10: launchTopLevelApp

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def launchTopLevelApp():
    root = tk.Tk()
    TopLevelApp(root)
    tk.mainloop() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:6,代码来源:program10.py

示例11: ControlledPorgressApp

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def ControlledPorgressApp():
    root = tk.Tk()
    ControlledProgress(root)
    tk.mainloop() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:6,代码来源:program8.py

示例12: launchSimpleCalenderApp

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def launchSimpleCalenderApp():
    root = tk.Tk()
    simpleCalender(root)
    tk.mainloop() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:6,代码来源:program7.py

示例13: launchPanedWindowApp

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def launchPanedWindowApp():
    root = tk.Tk()
    PanedWindowApp(root)
    tk.mainloop() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:6,代码来源:program11.py

示例14: _quit

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def _quit():
    root.quit()     # stops mainloop
    root.destroy()  # this is necessary on Windows to prevent
                    # Fatal Python Error: PyEval_RestoreThread: NULL tstate 
开发者ID:its-izhar,项目名称:Emotion-Recognition-Using-SVMs,代码行数:6,代码来源:Emotion Recognition.py

示例15: run

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import mainloop [as 别名]
def run(self):
        tk.mainloop() 
开发者ID:makelove,项目名称:OpenCV-Python-Tutorial,代码行数:4,代码来源:demo.py


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