Python tkinter.mainloop() Examples

The following are 30 code examples of tkinter.mainloop(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkinter , or try the search function .
Example #1
Source File: program13.py    From python-gui-demos with MIT License 6 votes vote down vote up
def launchApp():
    root = tk.Tk()
    App(root)
    tk.mainloop() 
Example #2
Source File: client_graphics.py    From Pyro5 with MIT License 6 votes vote down vote up
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() 
Example #3
Source File: ChessView.py    From cchess-zero with MIT License 6 votes vote down vote up
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 
Example #4
Source File: turtle.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def exitonclick(self):
        """Go into mainloop until the mouse is clicked.

        No arguments.

        Bind bye() method to mouseclick on TurtleScreen.
        If "using_IDLE" - value in configuration dictionary is False
        (default value), enter mainloop.
        If IDLE with -n switch (no subprocess) is used, this value should be
        set to True in turtle.cfg. In this case IDLE's mainloop
        is active also for the client script.

        This is a method of the Screen-class and not available for
        TurtleScreen instances.

        Example (for a Screen instance named screen):
        >>> screen.exitonclick()

        """
        def exitGracefully(x, y):
            """Screen.bye() with two dummy-parameters"""
            self.bye()
        self.onclick(exitGracefully)
        if _CFG["using_IDLE"]:
            return
        try:
            mainloop()
        except AttributeError:
            exit(0) 
Example #5
Source File: _backend_tk.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def mainloop():
        Tk.mainloop() 
Example #6
Source File: turtle.py    From Imogen with MIT License 5 votes vote down vote up
def mainloop(self):
        """Starts event loop - calling Tkinter's mainloop function.

        No argument.

        Must be last statement in a turtle graphics program.
        Must NOT be used if a script is run from within IDLE in -n mode
        (No subprocess) - for interactive use of turtle graphics.

        Example (for a TurtleScreen instance named screen):
        >>> screen.mainloop()

        """
        TK.mainloop() 
Example #7
Source File: turtle.py    From Imogen with MIT License 5 votes vote down vote up
def exitonclick(self):
        """Go into mainloop until the mouse is clicked.

        No arguments.

        Bind bye() method to mouseclick on TurtleScreen.
        If "using_IDLE" - value in configuration dictionary is False
        (default value), enter mainloop.
        If IDLE with -n switch (no subprocess) is used, this value should be
        set to True in turtle.cfg. In this case IDLE's mainloop
        is active also for the client script.

        This is a method of the Screen-class and not available for
        TurtleScreen instances.

        Example (for a Screen instance named screen):
        >>> screen.exitonclick()

        """
        def exitGracefully(x, y):
            """Screen.bye() with two dummy-parameters"""
            self.bye()
        self.onclick(exitGracefully)
        if _CFG["using_IDLE"]:
            return
        try:
            mainloop()
        except AttributeError:
            exit(0) 
Example #8
Source File: 10.06_focus_out _validation.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 5 votes vote down vote up
def __init__(self):
        self.master = tk.Tk()
        self.error_message = tk.Label(text='', fg='red')
        self.error_message.pack()
        tk.Label(text='Enter Email Address').pack()
        vcmd = (self.master.register(self.validate_email), '%P')
        invcmd = (self.master.register(self.invalid_email), '%P')
        self.email_entry = tk.Entry(
            self.master, validate="focusout", validatecommand=vcmd, invalidcommand=invcmd)
        self.email_entry.pack()
        tk.Button(self.master, text="Login").pack()
        tk.mainloop() 
Example #9
Source File: turtle.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def mainloop(self):
        """Starts event loop - calling Tkinter's mainloop function.

        No argument.

        Must be last statement in a turtle graphics program.
        Must NOT be used if a script is run from within IDLE in -n mode
        (No subprocess) - for interactive use of turtle graphics.

        Example (for a TurtleScreen instance named screen):
        >>> screen.mainloop()

        """
        TK.mainloop() 
Example #10
Source File: turtle.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def exitonclick(self):
        """Go into mainloop until the mouse is clicked.

        No arguments.

        Bind bye() method to mouseclick on TurtleScreen.
        If "using_IDLE" - value in configuration dictionary is False
        (default value), enter mainloop.
        If IDLE with -n switch (no subprocess) is used, this value should be
        set to True in turtle.cfg. In this case IDLE's mainloop
        is active also for the client script.

        This is a method of the Screen-class and not available for
        TurtleScreen instances.

        Example (for a Screen instance named screen):
        >>> screen.exitonclick()

        """
        def exitGracefully(x, y):
            """Screen.bye() with two dummy-parameters"""
            self.bye()
        self.onclick(exitGracefully)
        if _CFG["using_IDLE"]:
            return
        try:
            mainloop()
        except AttributeError:
            exit(0) 
Example #11
Source File: ahenkmessage.py    From ahenk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, message, title, host):

        self.message = message
        self.title = title
        self.host = host
        self.master = tk.Tk()
        self.master.title(self.title)

        if self.host != "":
            pass
        else:
             tk.Label(self.master, text="Etki Alanı Sunucusu : ").grid(row=0)
             self.e1 = tk.Entry(self.master)
             self.e1.grid(row=0, column=1)

        tk.Label(self.master, text="Yetkili Kullanıcı : ").grid(row=1)
        tk.Label(self.master, text="Parola : ").grid(row=2)

        self.e2 = tk.Entry(self.master)
        self.e3 = tk.Entry(show="*")

        self.var1 = IntVar()
        Checkbutton(self.master, text="Active Directory", variable=self.var1, command=self.check1).grid(row=3, column=0, stick=tk.W,
                                                                                         pady=4)
        self.var2 = IntVar()
        self.var2.set(1)
        Checkbutton(self.master, text="OpenLDAP", variable=self.var2, command=self.check2).grid(row=3, column=1, stick=tk.W, pady=4)


        self.e2.grid(row=1, column=1)
        self.e3.grid(row=2, column=1)

        tk.Button(self.master, text='Çıkış', command=self.master.quit).grid(row=4, column=0, sticky=tk.W, pady=4)
        tk.Button(self.master, text='Tamam', command=self.show).grid(row=4, column=1, sticky=tk.W, pady=4)
        tk.mainloop() 
Example #12
Source File: ahenkmessage.py    From ahenk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, message, title, host):

        self.message = message
        self.title = title
        self.host = host
        self.master = tk.Tk()
        self.master.title(self.title)

        if self.host != "":
            pass
        else:
             tk.Label(self.master, text="Etki Alanı Sunucusu : ").grid(row=0)
             self.e1 = tk.Entry(self.master)
             self.e1.grid(row=0, column=1)

        tk.Label(self.master, text="Yetkili Kullanıcı : ").grid(row=1)
        tk.Label(self.master, text="Parola : ").grid(row=2)

        self.e2 = tk.Entry(self.master)
        self.e3 = tk.Entry(show="*")

        self.var1 = IntVar()
        Checkbutton(self.master, text="Active Directory", variable=self.var1, command=self.check1).grid(row=3, column=0, stick=tk.W,
                                                                                         pady=4)
        self.var2 = IntVar()
        self.var2.set(1)
        Checkbutton(self.master, text="OpenLDAP", variable=self.var2, command=self.check2).grid(row=3, column=1, stick=tk.W, pady=4)


        self.e2.grid(row=1, column=1)
        self.e3.grid(row=2, column=1)

        tk.Button(self.master, text='Çıkış', command=self.master.quit).grid(row=4, column=0, sticky=tk.W, pady=4)
        tk.Button(self.master, text='Tamam', command=self.show).grid(row=4, column=1, sticky=tk.W, pady=4)
        tk.mainloop() 
Example #13
Source File: matrixMenu.py    From Raspberry-Pi-3-Cookbook-for-Python-Programmers-Third-Edition with MIT License 5 votes vote down vote up
def main():
  global root
  root=TK.Tk()
  root.title("Matrix GUI")
  myMatrixHW=MC.matrix(DEBUG)
  myMatrixGUI=matrixGUI(root,myMatrixHW)
  TK.mainloop() 
Example #14
Source File: render.py    From NetworkAttackSimulator with MIT License 5 votes vote down vote up
def __init__(self, episode, G, sensitive_hosts, width=7, height=7):
        self.episode = episode
        self.G = G
        self.sensitive_hosts = sensitive_hosts
        # used for moving between timesteps in episode
        self.timestep = 0
        self._setup_GUI(width, height)
        # draw first observation
        self._next_graph()
        # Initialize GUI drawing loop
        Tk.mainloop() 
Example #15
Source File: turtle.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def mainloop(self):
        """Starts event loop - calling Tkinter's mainloop function.

        No argument.

        Must be last statement in a turtle graphics program.
        Must NOT be used if a script is run from within IDLE in -n mode
        (No subprocess) - for interactive use of turtle graphics.

        Example (for a TurtleScreen instance named screen):
        >>> screen.mainloop()

        """
        TK.mainloop() 
Example #16
Source File: turtle.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def exitonclick(self):
        """Go into mainloop until the mouse is clicked.

        No arguments.

        Bind bye() method to mouseclick on TurtleScreen.
        If "using_IDLE" - value in configuration dictionary is False
        (default value), enter mainloop.
        If IDLE with -n switch (no subprocess) is used, this value should be
        set to True in turtle.cfg. In this case IDLE's mainloop
        is active also for the client script.

        This is a method of the Screen-class and not available for
        TurtleScreen instances.

        Example (for a Screen instance named screen):
        >>> screen.exitonclick()

        """
        def exitGracefully(x, y):
            """Screen.bye() with two dummy-parameters"""
            self.bye()
        self.onclick(exitGracefully)
        if _CFG["using_IDLE"]:
            return
        try:
            mainloop()
        except AttributeError:
            exit(0) 
Example #17
Source File: turtle.py    From odoo13-x64 with GNU General Public License v3.0 5 votes vote down vote up
def mainloop(self):
        """Starts event loop - calling Tkinter's mainloop function.

        No argument.

        Must be last statement in a turtle graphics program.
        Must NOT be used if a script is run from within IDLE in -n mode
        (No subprocess) - for interactive use of turtle graphics.

        Example (for a TurtleScreen instance named screen):
        >>> screen.mainloop()

        """
        TK.mainloop() 
Example #18
Source File: turtle.py    From odoo13-x64 with GNU General Public License v3.0 5 votes vote down vote up
def exitonclick(self):
        """Go into mainloop until the mouse is clicked.

        No arguments.

        Bind bye() method to mouseclick on TurtleScreen.
        If "using_IDLE" - value in configuration dictionary is False
        (default value), enter mainloop.
        If IDLE with -n switch (no subprocess) is used, this value should be
        set to True in turtle.cfg. In this case IDLE's mainloop
        is active also for the client script.

        This is a method of the Screen-class and not available for
        TurtleScreen instances.

        Example (for a Screen instance named screen):
        >>> screen.exitonclick()

        """
        def exitGracefully(x, y):
            """Screen.bye() with two dummy-parameters"""
            self.bye()
        self.onclick(exitGracefully)
        if _CFG["using_IDLE"]:
            return
        try:
            mainloop()
        except AttributeError:
            exit(0) 
Example #19
Source File: 011根据ip查询地理位置.py    From PythonGUIDemo with GNU General Public License v3.0 5 votes vote down vote up
def main():
    # 初始化对象
    FL = FindLocation()
    # 进行布局
    FL.gui_arrang()
    # 主程序执行
    tkinter.mainloop()
    pass 
Example #20
Source File: turtle.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def mainloop(self):
        """Starts event loop - calling Tkinter's mainloop function.

        No argument.

        Must be last statement in a turtle graphics program.
        Must NOT be used if a script is run from within IDLE in -n mode
        (No subprocess) - for interactive use of turtle graphics.

        Example (for a TurtleScreen instance named screen):
        >>> screen.mainloop()

        """
        TK.mainloop() 
Example #21
Source File: turtle.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def exitonclick(self):
        """Go into mainloop until the mouse is clicked.

        No arguments.

        Bind bye() method to mouseclick on TurtleScreen.
        If "using_IDLE" - value in configuration dictionary is False
        (default value), enter mainloop.
        If IDLE with -n switch (no subprocess) is used, this value should be
        set to True in turtle.cfg. In this case IDLE's mainloop
        is active also for the client script.

        This is a method of the Screen-class and not available for
        TurtleScreen instances.

        Example (for a Screen instance named screen):
        >>> screen.exitonclick()

        """
        def exitGracefully(x, y):
            """Screen.bye() with two dummy-parameters"""
            self.bye()
        self.onclick(exitGracefully)
        if _CFG["using_IDLE"]:
            return
        try:
            mainloop()
        except AttributeError:
            exit(0) 
Example #22
Source File: turtle.py    From android_universal with MIT License 5 votes vote down vote up
def mainloop(self):
        """Starts event loop - calling Tkinter's mainloop function.

        No argument.

        Must be last statement in a turtle graphics program.
        Must NOT be used if a script is run from within IDLE in -n mode
        (No subprocess) - for interactive use of turtle graphics.

        Example (for a TurtleScreen instance named screen):
        >>> screen.mainloop()

        """
        TK.mainloop() 
Example #23
Source File: turtle.py    From android_universal with MIT License 5 votes vote down vote up
def exitonclick(self):
        """Go into mainloop until the mouse is clicked.

        No arguments.

        Bind bye() method to mouseclick on TurtleScreen.
        If "using_IDLE" - value in configuration dictionary is False
        (default value), enter mainloop.
        If IDLE with -n switch (no subprocess) is used, this value should be
        set to True in turtle.cfg. In this case IDLE's mainloop
        is active also for the client script.

        This is a method of the Screen-class and not available for
        TurtleScreen instances.

        Example (for a Screen instance named screen):
        >>> screen.exitonclick()

        """
        def exitGracefully(x, y):
            """Screen.bye() with two dummy-parameters"""
            self.bye()
        self.onclick(exitGracefully)
        if _CFG["using_IDLE"]:
            return
        try:
            mainloop()
        except AttributeError:
            exit(0) 
Example #24
Source File: ChessView.py    From cchess-zero with MIT License 5 votes vote down vote up
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() 
Example #25
Source File: program9.py    From python-gui-demos with MIT License 5 votes vote down vote up
def DisplayAppLaunch():
    root = tk.Tk()
    DisplayApp(root)
    tk.mainloop() 
Example #26
Source File: program6.py    From python-gui-demos with MIT License 5 votes vote down vote up
def launchEntryApp():
    root = tk.Tk()
    entryApp(root)
    tk.mainloop() 
Example #27
Source File: program12.py    From python-gui-demos with MIT License 5 votes vote down vote up
def launchNoteBookApp():
    root = tk.Tk()
    NoteBookApp(root)
    tk.mainloop() 
Example #28
Source File: program10.py    From python-gui-demos with MIT License 5 votes vote down vote up
def launchTopLevelApp():
    root = tk.Tk()
    TopLevelApp(root)
    tk.mainloop() 
Example #29
Source File: program8.py    From python-gui-demos with MIT License 5 votes vote down vote up
def ControlledPorgressApp():
    root = tk.Tk()
    ControlledProgress(root)
    tk.mainloop() 
Example #30
Source File: program7.py    From python-gui-demos with MIT License 5 votes vote down vote up
def launchSimpleCalenderApp():
    root = tk.Tk()
    simpleCalender(root)
    tk.mainloop()