This happens in Tcl/Tk too. I'll follow up with the Tk folks and come back if there's any fix or workaround.
#!/usr/bin/env tclsh package require Tk bind . {<Escape>} {destroy .} wm minsize . 1280 800 frame .f_1 button .f_1.b -text {Frame 1} -command {destroy .} pack .f_1.b -expand true -fill both frame .f_2 button .f_2.b -text {2 emarF} -command {destroy .} pack .f_2.b -expand true -fill both set current 1 set delay 500 proc flip {} { global current global delay pack forget ".f_$current" if {$current == 1} then { set current 2 } else { set current 1 } pack ".f_$current" -expand true -fill both after $delay {flip} } pack ".f_$current" -expand true -fill both after $delay {flip} On Wed, Mar 28, 2018 at 2:42 AM, Michael Lange <klappn...@web.de> wrote: > Hi, > > On Wed, 28 Mar 2018 01:18:50 +0000 > Nam Nguyen <namngu...@google.com> wrote: > > > Is my code out of whack or is it "standard" enough to your seasoned > > eyes? Is there any guess as to a fix to this flickering, be it with my > > code, or Tk itself? > > of course you could address the "mouse over widget" issue with something > like > > b1 = tk.Button(f_1, text='Frame 1', font=my_font) > b1.pack(expand=True, fill=tk.BOTH) > bg = b1.cget('background') > b1.configure(activebackground=bg) > f_2 = tk.Frame(root) > tk.Button(f_2, text='Frame 2'[::-1], font=my_font, > activebackground=bg).pack( expand=True, fill=tk.BOTH) > > For the flicker that remains, I don't think there is much one can do > about it. If my assumption that it comes simply from the redrawing > operation is correct, I am afraid that there is no remedy (at least none > that I am aware of). Here it is barely visible but this might depend on > the speed of the system. When Brian says that he does not notice any > flicker at all, that might just be because his machine is faster than > mine. Of course there is still a chance that I have been missing > something. > > Best regards > > Michael > > > .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. > > Our way is peace. > -- Septimus, the Son Worshiper, "Bread and Circuses", > stardate 4040.7. >
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org https://mail.python.org/mailman/listinfo/tkinter-discuss