In wxpython, how can I drag a frame while having it play a GIF animation -
i'm using wxpython-phoenix 3.0.3 version this.
i make draggable image plays gif animation. function works fine when comment out animation part, doesn't work when animation played. how can make them work together?
import wx wx.adv import animationctrl class yukari(wx.frame): def __init__(self, parent, id, title): wx.frame.__init__(self, parent, -1, title) self.bind(wx.evt_motion, self.onmouse) self.bind(wx.evt_char_hook, self.closewindow) self.animation = animationctrl(self) self.animation.loadfile('resized_yuzuki-yukari.gif') self.animation.play() self.setsize((497, 720)) self.setwindowstyle(wx.simple_border | wx.stay_on_top) self.show() def onmouse(self, event): if not event.dragging(): self._dragpos = none pass if not self._dragpos: self._dragpos = event.getposition() else: pos = event.getposition() displacement = self._dragpos - pos print(displacement) self.setposition(self.getposition() - displacement) def closewindow(self, event): key_code = event.getkeycode() if key_code == wx.wxk_escape: self.destroy() event.skip() app = wx.app() frame = yukari(none, -1, 'yuzuki yukari') app.mainloop()
this works fine on linux mate 17, python 2.7, wx.python ('2.8.12.1 (gtk2-unicode)', using from wx.animate import animationctrl
.
when "but doesn't work when animation played", way doesn't work , when state "draggable image" mean image "draggable" within frame or frame draggable?
plus believe need put item within wx.panel() able activate event motion i.e.
self.panel1 = wx.panel(self) self.panel1.bind(wx.evt_motion, self.onmouse) self.panel1.bind(wx.evt_char_hook, self.closewindow) self.animation = animationctrl(self.panel1)
Comments
Post a Comment