當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。