简体   繁体   中英

Tkinter: PanedWindow sash causing tearing if I add Frames to the PanedWindow

I have an issue with the PanedWindow when my sash is moving to the left. It is fine when I move it to the right. However, when I move it to the left, the rightmost Frame widget tears for half a second before updating and snapping into place. The tearing gets worse if I drag the sash too fast to the left.

I am currently using Python3 for this, as well as Tkinter version 8.6.

Here is an example code. You have to expand the window size to see it clearly:

from tkinter import *
root = Tk()
m = PanedWindow(root, orient=HORIZONTAL, sashwidth=10)
rightF =  Frame(m)
leftF = Frame(m)
top = Label(leftF, text="lefgt pane", bg='blue')
bottom = Label(rightF, text="right pane", bg='red')
top.pack(fill=BOTH, expand=1)
bottom.pack(fill=BOTH, expand=1)
m.add(leftF)
m.add(rightF)

m.pack(fill=BOTH, expand=1)
mainloop()

This seems to only happen when I add Frames into PanedWindow. Has anyone gotten around this somehow? Does anyone see it? I am using Mac OSX Mavericks if that helps.

I never expected the speed of Tkinter.

When you add Frame than it have to redraw Frame before it redraw Label but Frame has different background color then Label - and you see it. Set red background for right Frame and you shouldn't see problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM