문제

I was wondering if it was possible to have tween animation in wxPython. I have tried looking at all the documentation but cannot seem to spot an reference to it. An example of what I am after would be having a button fly from the bottom of the window to the top. Is there such a way?

도움이 되었습니까?

해결책

not exactly...

there is no magic tween function builtin to wx afaik, however you can use timers to create an update interval and animate it yourself

import wx
global btn
def updater():
    p = btn.GetPosition()
    btn.SetPosition((p[0] ,p[1] - 2))
    wx.CallLater(50,updater)
a= wx.App(redirect=False)

f = wx.Frame(None,-1,"Animation",size=(400,600))
p = wx.Panel(f,-1)
btn = wx.Button(p,-1,"Click Me",pos=(175,520))
f.Show()
wx.CallLater(50,updater) #could have used a normal timer just as easy ... maybe even easier
a.MainLoop()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top