简体   繁体   English

在Python 3(tkinter)中是否可以对框架进行动画处理?

[英]In Python 3 (tkinter) is it possible to animate a frame?

I have a tk window with some packed frames and I want a new panel to slide up from the window bottom (and do the reverse movement when getting out of the screen). 我有一个带有打包框架的tk窗口,我希望一个新面板从窗口底部向上滑动(在离开屏幕时进行反向移动)。 This is the code I am using to make this panel show up statically at the intended position (its placed in a position relative to self.statusframe that is packed at the window bottom): 这是我用来使该面板静态显示在预期位置的代码(它放置在相对于self.statusframe的位置,该位置包装在窗口底部):

self.bottomframe.place(in_=self.statusframe, relx=1,  y=0, anchor="se", relwidth=1, bordermode="outside")
self.bottomframe.lift()

Is there an easy way to animate a placed tkinter frame so that it seems to be sliding up into the intended position? 有没有一种简单的方法可以对放置的Tkinter框架进行动画处理,使其看起来像滑到预期的位置?

Just to post an update that might be useful to those who come across this question, after reading Bryan Oakley's comment and digging a little more, in this case I ended up using this code, that I believe does what I intended: 在阅读了布莱恩·奥克利的评论并进行了更深入的研究后,为了发布一个可能对遇到此问题的人可能有用的更新,在这种情况下,我最终使用了这段代码,我相信我打算这样做:

for y in range(-10,1,2):
    self.bottomframe.update()
    self.bottomframe.place(in_=self.statusframe, relx=1,  y=y**2, anchor="se", relwidth=1, bordermode="outside")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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