我有一个 Python 2.7/PyGTK 2.24 项目。我正在 Linux Ubuntu 11 上构建。
我正在使用以下代码为图像在屏幕上的移动设置动画。
def move_fish():
global fishmove, flipped
if fishmove < 440 and flipped == False:
fishmove = fishmove + 10
fixed_hab.move(fish1, fishmove, 50)
return True
elif fishmove == 440 and flipped == False:
pixbufanim = gtk.gdk.PixbufAnimation("IMG/IMG-FISH-L.gif")
fish1.set_from_animation(pixbufanim)
flipped = True
fishmove = fishmove - 10
fixed_hab.move(fish1, fishmove, 50)
return True
elif fishmove > 0 and flipped == True:
fishmove = fishmove - 10
fixed_hab.move(fish1, fishmove, 50)
return True
elif fishmove == 0 and flipped == True:
pixbufanim = gtk.gdk.PixbufAnimation("IMG/IMG-FISH-R.gif")
fish1.set_from_animation(pixbufanim)
flipped = False
return True
gobject.timeout_add(100, move_fish)
代码运行良好,运行时没有编译错误或错误。但是,关闭窗口后,我多次收到以下错误。(请注意,fixed_hab (gtk.Fixed) 和 fish1 (gtk.Image) 对象与函数声明“def move_fish():”在同一范围内
Word4Word-9-16.py:1655: GtkWarning: gtk_fixed_move_internal: 断言`widget->parent == GTK_WIDGET (fixed)' 失败 fixed_hab.move(fish1, fishmove, 50)
这严重吗?我可以修复它吗?这会给最终用户带来困难吗?
提前致谢!