Re: How to eliminate flickers when swapping frames?
Bryan Oakley <[email protected]> Tue, 27 Mar 2018 15:17:15 -0500
| Newsgroups | gmane.comp.python.tkinter |
|---|---|
| Message-ID | <CAKypQnwHqdXcQpvWEgA9DQBsP8eBGAqSCc-niLLbXNF1kh=CeA@mail.gmail.com> |
I don't see any flicker when I run that. On Tue, Mar 27, 2018 at 2:57 PM, Nam Nguyen via Tkinter-discuss < [email protected]> wrote: > A simple reprod code: > > import tkinter as tk > from tkinter import font > > > root = tk.Tk() > root.minsize(1280, 800) > root.bind('<Escape>', lambda _: root.quit()) > > my_font = font.Font(root, 'Sans 128 bold') > f_1 = tk.Frame(root) > tk.Button(f_1, text='Frame 1', font=my_font).pack( > expand=True, fill=tk.BOTH) > f_2 = tk.Frame(root) > tk.Button(f_2, text='Frame 2'[::-1], font=my_font).pack( > expand=True, fill=tk.BOTH) > > f_1.pack(expand=True, fill=tk.BOTH) > current = f_1 > > def flip(): > global current > current.pack_forget() > if current is f_1: > current = f_2 > else: > current = f_1 > current.pack(expand=True, fill=tk.BOTH) > root.after(1000, flip) > > root.after(1000, flip) > root.mainloop() > > Nam > > On Tue, Mar 27, 2018 at 8:29 AM, Nam Nguyen <[email protected]> wrote: > >> Hi list, >> >> I have several ttk.Frames belonging to the same parent (master, but I try >> not to use that word) that are swapped in and out depending on some >> external event. >> >> What I observe so far is there is some flickering every time a frame is >> swapped out and another swapped in. I have tried using both place and pack >> geometry managers. >> >> Do you have any tip/trick to eliminate this flickering? >> >> Thanks! >> Nam >> > > > _______________________________________________ > Tkinter-discuss mailing list > [email protected] > https://mail.python.org/mailman/listinfo/tkinter-discuss > > _______________________________________________ Tkinter-discuss mailing list [email protected] https://mail.python.org/mailman/listinfo/tkinter-discuss